[Calypso] How to run the tests?

Petter Reinholdtsen pere at hungry.com
Fri Jan 22 04:11:52 PST 2016


Hi.

I was planning to extend the calypso self tests to verify that several
vCards could be imported from one file, and that UTF-8 was handled
correctly, but have not been able to get it working.  I seem to be
unable to run the test script.  What is the correct procedure for doing
this?

I run it like this, and wonder if I am doing it wrong.

pere at minerva:~/src/debian/calypso$ python setup.py test
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_requires'
  warnings.warn(msg)
running test
Searching for daemon
Best match: daemon 1.1
Processing daemon-1.1-py2.7.egg

Using /home/pere/src/debian/calypso/.eggs/daemon-1.1-py2.7.egg
running egg_info
writing requirements to calypso.egg-info/requires.txt
writing calypso.egg-info/PKG-INFO
writing top-level names to calypso.egg-info/top_level.txt
writing dependency_links to calypso.egg-info/dependency_links.txt
reading manifest file 'calypso.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'calypso.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
pere at minerva:~/src/debian/calypso$

I modified the tests to ensure it should fail, which seem to be
completely ignored:

diff --git a/tests/data/import.vcard b/tests/data/import.vcard
index b9d2c5f..f48eecd 100644
--- a/tests/data/import.vcard
+++ b/tests/data/import.vcard
@@ -1,4 +1,11 @@
 BEGIN:VCARD
+VERSION:3.0
+FN:Universitetet i Tromsø
+ORG:Universitetet i Tromsø
+TEL;TYPE=WORK:+47 77 64 40 00
+END:VCARD
+
+BEGIN:VCARD
 VERSION:4.0
 N:Gump;Forrest;;;
 FN:Forrest Gump
diff --git a/tests/test_collection.py b/tests/test_collection.py
index 8e80faf..72ee7c9 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -15,15 +15,19 @@ class TestCollection(unittest.TestCase):
     test_vcard = "tests/data/import.vcard"
 
     def setUp(self):
+        print("Setting up test environment")
         self.tmpdir = tempfile.mkdtemp()
         calypso.config.set('storage', 'folder', self.tmpdir)
         subprocess.call(["git", "init", self.tmpdir]),
 
     def tearDown(self):
+        print("Tearing down test environment")
         if self.tmpdir:
             shutil.rmtree(self.tmpdir)
 
     def test_import_file(self):
         collection = Collection("")
         self.assertTrue(collection.import_file(self.test_vcard))
-        self.assertEqual(len(collection.items), 1)
+        self.assertEqual(len(collection.items), 2)
+        print collection
+        self.assertTrue(False)

-- 
Happy hacking
Petter Reinholdtsen


More information about the Calypso mailing list