Selaa lähdekoodia

Fixes for testing

Oz N Tiram 9 vuotta sitten
vanhempi
commit
ebcc1cd9f7
3 muutettua tiedostoa jossa 14 lisäystä ja 3 poistoa
  1. 5 1
      blogit2.py
  2. 4 1
      setup.py
  3. 5 1
      tests/test_tag.py

+ 5 - 1
blogit2.py

@@ -566,7 +566,8 @@ def dist(SOURCEDIR=os.getcwd()+"/content/",
     sp.call(["rsync", "-avP", SOURCEDIR, DESTDIR], shell=False,
             cwd=os.getcwd())
 
-if __name__ == '__main__':
+
+def main():
     parser = argparse.ArgumentParser(
         description='blogit - a tool to blog on github.')
     parser.add_argument('-b', '--build', action="store_true",
@@ -599,3 +600,6 @@ if __name__ == '__main__':
         new_post()
     if args.publish:
         publish()
+
+if __name__ == '__main__':
+    main()

+ 4 - 1
setup.py

@@ -6,5 +6,8 @@ from setuptools import find_packages
 setup(name='blogit2',
       version='0.0.1',
       license="GNU GPL",
-          scripts=['blogit2.py']
+      entry_points={
+          'console_scripts': ['blogit2 = blogit2:main']
+          }
       )
+

+ 5 - 1
tests/test_tag.py

@@ -34,5 +34,9 @@ def test_tag():
     t.posts = [1,2,3]
     t.render()
 
+import pytest
 
-
+def test_raises():
+    t = Tag('python')
+    with pytest.raises(ValueError):
+        t.posts = 1