From 3b0ba0bb3ca6158fba18bdc6e104e6b0dda91611 Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Sun, 20 Dec 2015 18:47:12 +0100 Subject: [PATCH] Test for leading space in citekeys This test is expected to fail. Nose does not handle that yet (treats it as false). As such, changes have been made to make tests discoverable by unittest. You may want to uninstall nose and do something like: alias nosetests="python -m unittest discover" in your bashrc Related: #25 --- tests/__init__.py | 0 tests/bibexamples/leadingspace.bib | 4 ++++ tests/{data => bibexamples}/utf8.bib | 0 tests/test_usecase.py | 13 ++++++++++++- 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/__init__.py create mode 100644 tests/bibexamples/leadingspace.bib rename tests/{data => bibexamples}/utf8.bib (100%) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/bibexamples/leadingspace.bib b/tests/bibexamples/leadingspace.bib new file mode 100644 index 0000000..ebe863e --- /dev/null +++ b/tests/bibexamples/leadingspace.bib @@ -0,0 +1,4 @@ +@article{ Space, + author = {Name, FirstName}, + title = {Title}, +} diff --git a/tests/data/utf8.bib b/tests/bibexamples/utf8.bib similarity index 100% rename from tests/data/utf8.bib rename to tests/bibexamples/utf8.bib diff --git a/tests/test_usecase.py b/tests/test_usecase.py index 5bc1ed4..abcb1a1 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -121,6 +121,7 @@ class DataCommandTestCase(CommandTestCase): def setUp(self): super(DataCommandTestCase, self).setUp() fake_env.copy_dir(self.fs, os.path.join(os.path.dirname(__file__), 'data'), 'data') + fake_env.copy_dir(self.fs, os.path.join(os.path.dirname(__file__), 'bibexamples'), 'bibexamples') # Actual tests @@ -174,7 +175,7 @@ class TestAdd(DataCommandTestCase): "utf-8 citekeys are not supported yet.\n" "See https://github.com/pubs/pubs/issues/28 for details.") # actually not checked cmds = ['pubs init', - ('pubs add /data/utf8.bib', [], '', err), + ('pubs add /bibexamples/utf8.bib', [], '', err), ] with self.assertRaises(SystemExit): self.execute_cmds(cmds) @@ -203,6 +204,16 @@ class TestAdd(DataCommandTestCase): with self.assertRaises(SystemExit): self.execute_cmds(cmds) + @unittest.expectedFailure + def test_leading_citekey_space(self): + cmds = ['pubs init', + 'pubs add /data/leadingspace.bib', + 'pubs rename LeadingSpace NoLeadingSpace', + ] + self.execute_cmds(cmds) + + + class TestList(DataCommandTestCase):