From e0fd19f9d842693726112c370f0695df27e73e96 Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 12:28:00 +0100 Subject: [PATCH 01/13] first input test working --- tests/test_usecase.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/test_usecase.py b/tests/test_usecase.py index c7db347..d8c717c 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -28,7 +28,7 @@ def _mod_list(): path=papers.__path__, prefix=papers.__name__+'.', onerror=lambda x: None): - ml.append(__import__(modname, fromlist = 'dummy')) + ml.append((modname, __import__(modname, fromlist = 'dummy'))) return ml mod_list = _mod_list() @@ -50,7 +50,7 @@ def _create_fake_fs(): sys.modules['shutil'] = fake_shutil sys.modules['glob'] = fake_glob - for md in mod_list: + for mdname, md in mod_list: md.os = fake_os md.shutil = fake_shutil @@ -104,13 +104,15 @@ class FakeInput(): self._cursor = 0 def as_global(self): - for md in mod_list: + for mdname, md in mod_list: md.input = self + if mdname == 'papers.files': + md.editor_input = self def add_input(self, inp): self.inputs.append(inp) - def __call__(self): + def __call__(self, *args, **kwargs): inp = self.inputs[self._cursor] self._cursor += 1 return inp @@ -135,9 +137,9 @@ def _execute_cmds(cmds, fs = None): outs = [] for cmd in cmds: - if hasattr('__iter__', cmd): + if hasattr(cmd, '__iter__'): if len(cmd) == 2: - input = FakeInput(cmd[2]) + input = FakeInput(cmd[1]) input.as_global() _, stdout, stderr = redirect(papers_cmd.execute)(cmd[0].split()) @@ -264,7 +266,7 @@ class TestUsecase(unittest.TestCase): 'papers add -b data/10.1371%2Fjournal.pone.0038236.bib', 'papers list', 'papers attach Page99 data/pagerank.pdf', - 'papers remove -f Page99', + ('papers remove Page99', ['y']), 'papers remove -f turing1950computing', ] From e4ad9745c1d4e7a9399bb146cb6e5e218b447b0c Mon Sep 17 00:00:00 2001 From: Olivier Mangin Date: Thu, 4 Jul 2013 18:13:30 +0200 Subject: [PATCH 02/13] Fix bug and adds doc. - Fix wrong call to editor_input in add_cmd. - Adds docstring to PapersInRepo class. --- papers/commands/add_cmd.py | 2 +- papers/paper.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/papers/commands/add_cmd.py b/papers/commands/add_cmd.py index 57f4399..538c62e 100644 --- a/papers/commands/add_cmd.py +++ b/papers/commands/add_cmd.py @@ -39,7 +39,7 @@ def command(args): bibstr = '' while cont: try: - bibstr = files.editor_input(config, bibstr, suffix='.yaml') + bibstr = files.editor_input(config().edit_cmd, bibstr, suffix='.yaml') key, bib = get_bibentry_from_string(bibstr) cont = False except Exception: diff --git a/papers/paper.py b/papers/paper.py index a5885db..d1018f3 100644 --- a/papers/paper.py +++ b/papers/paper.py @@ -271,7 +271,10 @@ class Paper(object): self.tags.discard(tag) -class PaperInRepo(Paper): # TODO document why this class exists (fabien, 2013/06) +class PaperInRepo(Paper): + """Extend paper class with command specific to the case where the paper + lives in a repository. + """ def __init__(self, repo, *args, **kwargs): Paper.__init__(self, *args, **kwargs) From cc3928ef4bb033b4d2548efc7ed6867f382f1cf4 Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 18:05:53 +0100 Subject: [PATCH 03/13] fake editor_input --- papers/commands/add_cmd.py | 2 +- tests/test_usecase.py | 40 +++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/papers/commands/add_cmd.py b/papers/commands/add_cmd.py index 57f4399..50b8bae 100644 --- a/papers/commands/add_cmd.py +++ b/papers/commands/add_cmd.py @@ -47,7 +47,7 @@ def command(args): question='Invalid bibfile. Edit again ?', default='y') if not cont: - ui.exit() + ui.exit(0) p = Paper(bibentry=bib, citekey=key) else: p = Paper.load(bibfile) diff --git a/tests/test_usecase.py b/tests/test_usecase.py index d8c717c..8226a3b 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -8,7 +8,7 @@ import fake_filesystem_shutil import fake_filesystem_glob from papers import papers_cmd -from papers import color +from papers import color, files from papers.p3 import io, input @@ -43,8 +43,13 @@ def _create_fake_fs(): fake_glob = fake_filesystem_glob.FakeGlobModule(fake_fs) fake_fs.CreateDirectory(fake_os.path.expanduser('~')) - __builtins__['open'] = fake_open - __builtins__['file'] = fake_open + + try: + __builtins__.open = fake_open + __builtins__.file = fake_open + except AttributeError: + __builtins__['open'] = fake_open + __builtins__['file'] = fake_open sys.modules['os'] = fake_os sys.modules['shutil'] = fake_shutil @@ -53,6 +58,8 @@ def _create_fake_fs(): for mdname, md in mod_list: md.os = fake_os md.shutil = fake_shutil + md.open = fake_open + md.file = fake_open return fake_fs @@ -152,7 +159,7 @@ def _execute_cmds(cmds, fs = None): assert type(cmd) == str _, stdout, stderr = redirect(papers_cmd.execute)(cmd.split()) - print stderr + assert(stderr.getvalue() == '') outs.append(color.undye(stdout.getvalue())) return outs @@ -210,7 +217,7 @@ class TestInput(unittest.TestCase): with self.assertRaises(IndexError): input() - def test_input(self): + def test_input2(self): other_input = FakeInput(['yes', 'no']) other_input.as_global() self.assertEqual(color.input(), 'yes') @@ -218,6 +225,14 @@ class TestInput(unittest.TestCase): with self.assertRaises(IndexError): color.input() + def test_editor_input(self): + other_input = FakeInput(['yes', 'no']) + other_input.as_global() + self.assertEqual(files.editor_input(), 'yes') + self.assertEqual(files.editor_input(), 'no') + with self.assertRaises(IndexError): + color.input() + class TestUsecase(unittest.TestCase): @@ -272,4 +287,19 @@ class TestUsecase(unittest.TestCase): _execute_cmds(cmds) + def test_editor(self): + + with self.assertRaises(SystemExit): + cmds = ['papers init', + ('papers add', ['abc', 'n']) + ] + + _execute_cmds(cmds) + + +# if __name__ == "__main__": +# cmds = ['papers init', +# 'papers add', ['', 'n']] +# +# _execute_cmds(cmds) From 3b7900a3a4db7cae7576c8d502271088974d11ad Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 18:07:01 +0100 Subject: [PATCH 04/13] added tests/tmpdir* to gitignore --- .gitignore | 1 - tests/.gitignore | 2 ++ tests/test.sh | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 tests/.gitignore diff --git a/.gitignore b/.gitignore index 0dfdfda..114bd34 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,5 @@ build/ dist/ *~ *.pyc -tests/paper_test papers.egg-info .DS_Store diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..77eb33e --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,2 @@ +tmpdir* +*.bak diff --git a/tests/test.sh b/tests/test.sh index 7bfba55..739b7db 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -rm -Rf paper_test/*; -papers init -p paper_test/; +rm -Rf tmpdir/*; +papers init -p tmpdir/; papers add -d data/pagerank.pdf -b data/pagerank.bib; papers list; papers tag; @@ -8,4 +8,4 @@ papers tag Page99 network+search; papers tag Page99; papers tag search; papers tag 0; -rm -Rf paper_test/*; +rm -Rf tmpdir/*; From 04fcb42338b008199dbe328335ee65a61af45a50 Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 18:31:21 +0100 Subject: [PATCH 05/13] tests can be run from root dir --- tests/test_usecase.py | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/tests/test_usecase.py b/tests/test_usecase.py index 8226a3b..213fbf1 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -65,13 +65,15 @@ def _create_fake_fs(): def _copy_data(fs): """Copy all the data directory into the fake fs""" - for filename in real_os.listdir('data/'): - filepath = 'data/' + filename - if real_os.path.isfile(filepath): - with real_open(filepath, 'r') as f: - fs.CreateFile(filepath, contents = f.read()) - if real_os.path.isdir(filepath): - fs.CreateDirectory(filepath) + datadir = real_os.path.join(real_os.path.dirname(__file__), 'data') + for filename in real_os.listdir(datadir): + real_path = real_os.path.join(datadir, filename) + fake_path = fake_os.path.join('data', filename) + if real_os.path.isfile(real_path): + with real_open(real_path, 'r') as f: + fs.CreateFile(fake_path, contents = f.read()) + if real_os.path.isdir(real_path): + fs.CreateDirectory(fake_path) # redirecting output @@ -142,6 +144,7 @@ def _execute_cmds(cmds, fs = None): fs = _create_fake_fs() _copy_data(fs) + outs = [] for cmd in cmds: if hasattr(cmd, '__iter__'): @@ -287,19 +290,20 @@ class TestUsecase(unittest.TestCase): _execute_cmds(cmds) - def test_editor(self): + def test_editor_abort(self): with self.assertRaises(SystemExit): cmds = ['papers init', ('papers add', ['abc', 'n']) ] - - _execute_cmds(cmds) + _execute_cmds(cmds) -# if __name__ == "__main__": -# cmds = ['papers init', -# 'papers add', ['', 'n']] -# -# _execute_cmds(cmds) - + # def test_editor_success(self): + # with real_open('data/', 'r') + # + # cmds = ['papers init', + # ('papers add', ['abc', 'n']) + # ] + # + # _execute_cmds(cmds) From 6c9d4a3a41384d5877b1fca94d5404db0fa374ef Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 18:59:30 +0100 Subject: [PATCH 06/13] lot more test in test_usecase : every command used --- tests/test_usecase.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/tests/test_usecase.py b/tests/test_usecase.py index 213fbf1..3e56713 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -28,7 +28,9 @@ def _mod_list(): path=papers.__path__, prefix=papers.__name__+'.', onerror=lambda x: None): - ml.append((modname, __import__(modname, fromlist = 'dummy'))) + # HACK to not load textnote + if not modname.startswith('papers.plugs.texnote'): + ml.append((modname, __import__(modname, fromlist = 'dummy'))) return ml mod_list = _mod_list() @@ -294,16 +296,20 @@ class TestUsecase(unittest.TestCase): with self.assertRaises(SystemExit): cmds = ['papers init', - ('papers add', ['abc', 'n']) + ('papers add', ['abc', 'n']), + ('papers add', ['abc', 'y', 'abc', 'n']) ] _execute_cmds(cmds) - # def test_editor_success(self): - # with real_open('data/', 'r') - # - # cmds = ['papers init', - # ('papers add', ['abc', 'n']) - # ] - # - # _execute_cmds(cmds) + def test_editor_success(self): + bibpath = real_os.path.join(real_os.path.dirname(__file__), 'data', 'pagerank.bib') + with real_open(bibpath, 'r') as f: + bibtext = f.read() + + cmds = ['papers init', + ('papers add', [bibtext]), + ('papers remove Page99', ['y']), + ] + + _execute_cmds(cmds) From 7d06200c664d1e27ba988b99be73334b6ab30c5a Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 20:14:29 +0100 Subject: [PATCH 07/13] project ackrc file --- .ackrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ackrc diff --git a/.ackrc b/.ackrc new file mode 100644 index 0000000..1617d11 --- /dev/null +++ b/.ackrc @@ -0,0 +1 @@ +--ignore-directory=is:build From f82b913a8033b82bc20214c79cd8accc1b2516ea Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 21:06:45 +0100 Subject: [PATCH 08/13] FIX import_cmd typo --- papers/commands/import_cmd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/papers/commands/import_cmd.py b/papers/commands/import_cmd.py index ce13f2c..cb81fb9 100644 --- a/papers/commands/import_cmd.py +++ b/papers/commands/import_cmd.py @@ -22,7 +22,7 @@ def command(args): ui = args.ui bibpath = args.bibpath - copy = agrs.copy + copy = args.copy if copy is None: copy = config().import_copy From 145710b92873bf4d9635f4769ae8dca20bf7b897 Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 21:15:03 +0100 Subject: [PATCH 09/13] test for every command except websearch and update --- tests/fixtures.py | 31 +++++++++++++++++ tests/test_usecase.py | 79 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 100 insertions(+), 10 deletions(-) diff --git a/tests/fixtures.py b/tests/fixtures.py index 86bc7b6..3098283 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -16,3 +16,34 @@ doe2013.bibentry.fields['title'] = u'Nice title.' doe2013.bibentry.fields['year'] = u'2013' doe2013.bibentry.persons['author'] = [Person(u'John Doe')] doe2013.citekey = doe2013.generate_citekey() + + +pagerankbib = """ +@techreport{Page99, + number = {1999-66}, + month = {November}, + author = {Lawrence Page and Sergey Brin and Rajeev Motwani and Terry Winograd}, + note = {Previous number = SIDL-WP-1999-0120}, + title = {The PageRank Citation Ranking: Bringing Order to the Web.}, + type = {Technical Report}, + publisher = {Stanford InfoLab}, + year = {1999}, +institution = {Stanford InfoLab}, + url = {http://ilpubs.stanford.edu:8090/422/}, +} +""" + +pagerankbib_generated = """@techreport{ + Page99, + author = "Page, Lawrence and Brin, Sergey and Motwani, Rajeev and Winograd, Terry", + publisher = "Stanford InfoLab", + title = "The PageRank Citation Ranking: Bringing Order to the Web.", + url = "http://ilpubs.stanford.edu:8090/422/", + number = "1999-66", + month = "November", + note = "Previous number = SIDL-WP-1999-0120", + year = "1999", + institution = "Stanford InfoLab" +} + +""" \ No newline at end of file diff --git a/tests/test_usecase.py b/tests/test_usecase.py index 3e56713..98abc7d 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -1,6 +1,7 @@ import sys, os, shutil, glob import unittest import pkgutil +import re import testenv import fake_filesystem @@ -11,6 +12,8 @@ from papers import papers_cmd from papers import color, files from papers.p3 import io, input +import fixtures + # code for fake fs @@ -117,8 +120,9 @@ class FakeInput(): def as_global(self): for mdname, md in mod_list: md.input = self - if mdname == 'papers.files': - md.editor_input = self + md.editor_input = self + # if mdname.endswith('files'): + # md.editor_input = self def add_input(self, inp): self.inputs.append(inp) @@ -131,7 +135,7 @@ class FakeInput(): # putting it all together -def _execute_cmds(cmds, fs = None): +def _execute_cmds(cmds, test_instance = None, fs = None): """ Execute a list of commands, and capture their output A command can be a string, or a tuple of size 2 or 3. @@ -158,7 +162,8 @@ def _execute_cmds(cmds, fs = None): if len(cmd) == 3: actual_out = color.undye(stdout.getvalue()) correct_out = color.undye(cmd[2]) - self.assertEqual(actual_out, correct_out) + if test_instance is not None: + test_instance.assertEqual(actual_out, correct_out) else: assert type(cmd) == str @@ -297,19 +302,73 @@ class TestUsecase(unittest.TestCase): with self.assertRaises(SystemExit): cmds = ['papers init', ('papers add', ['abc', 'n']), - ('papers add', ['abc', 'y', 'abc', 'n']) + ('papers add', ['abc', 'y', 'abc', 'n']), + 'papers add -b data/pagerank.bib', + ('papers edit Page99', ['', 'a']), ] _execute_cmds(cmds) def test_editor_success(self): - bibpath = real_os.path.join(real_os.path.dirname(__file__), 'data', 'pagerank.bib') - with real_open(bibpath, 'r') as f: - bibtext = f.read() - cmds = ['papers init', - ('papers add', [bibtext]), + ('papers add', [fixtures.pagerankbib]), ('papers remove Page99', ['y']), ] _execute_cmds(cmds) + + def test_edit(self): + bib = fixtures.pagerankbib + bib1 = re.sub('year = \{1999\}', 'year = {2007}', bib) + bib2 = re.sub('Lawrence Page', 'Lawrence Ridge', bib1) + bib3 = re.sub('Page99', 'Ridge07', bib2) + + line = '0: [Page99] L. Page et al. "The PageRank Citation Ranking Bringing Order to the Web" (1999) \n' + line1 = re.sub('1999', '2007', line) + line2 = re.sub('L. Page', 'L. Ridge', line1) + line3 = re.sub('Page99', 'Ridge07', line2) + + cmds = ['papers init', + 'papers add -b data/pagerank.bib', + ('papers list', [], line), + ('papers edit Page99', [bib1]), + ('papers list', [], line1), + ('papers edit Page99', [bib2]), + ('papers list', [], line2), + ('papers edit Page99', [bib3]), + ('papers list', [], line3), + ] + + _execute_cmds(cmds, test_instance = self) + + def test_export(self): + cmds = ['papers init', + ('papers add', [fixtures.pagerankbib]), + 'papers export Page99', + ('papers export Page99 -f bibtex', [], fixtures.pagerankbib_generated), + 'papers export Page99 -f bibyaml', + ] + + _execute_cmds(cmds) + + def test_import(self): + cmds = ['papers init', + 'papers import data/', + 'papers list' + ] + + outs = _execute_cmds(cmds) + self.assertEqual(4+1, len(outs[-1].split('\n'))) + + def test_open(self): + cmds = ['papers init', + 'papers add -b data/pagerank.bib', + 'papers open Page99' + ] + + with self.assertRaises(SystemExit): + _execute_cmds(cmds) + + with self.assertRaises(SystemExit): + cmds[-1] == 'papers open Page8' + _execute_cmds(cmds) From 9c47951532f7f558f98c9076961ceee7d96c6386 Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 21:16:57 +0100 Subject: [PATCH 10/13] don't remove files at end of test.sh --- tests/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test.sh b/tests/test.sh index 739b7db..c9e2521 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -8,4 +8,4 @@ papers tag Page99 network+search; papers tag Page99; papers tag search; papers tag 0; -rm -Rf tmpdir/*; +#rm -Rf tmpdir/*; From f62b31542dbe2111083e70f28e8b4fa01221d8c9 Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 21:17:19 +0100 Subject: [PATCH 11/13] cosmetics in edit_cmd --- papers/commands/edit_cmd.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/papers/commands/edit_cmd.py b/papers/commands/edit_cmd.py index c2f8bc6..513ea4e 100644 --- a/papers/commands/edit_cmd.py +++ b/papers/commands/edit_cmd.py @@ -16,18 +16,18 @@ def parser(subparsers): def command(args): - ui = args.ui - meta = args.meta + ui = args.ui + meta = args.meta reference = args.reference rp = repo.Repository(config()) key = parse_reference(ui, rp, reference) paper = rp.get_paper(key) - filepath = rp._bibfile(key) - if meta: - filepath = rp._metafile(key) + filepath = rp._metafile(key) if meta else rp._bibfile(key) + with open(filepath) as f: content = f.read() + while True: # Get new content from user content = editor_input(config().edit_cmd, content) @@ -46,10 +46,10 @@ def command(args): except repo.CiteKeyCollision: options = ['overwrite', 'edit again', 'abort'] choice = options[ui.input_choice( - options, - ['o', 'e', 'a'], + options, ['o', 'e', 'a'], question='A paper already exist with this citekey.' )] + if choice == 'abort': break elif choice == 'overwrite': From 9247c0d3f32ed57ebbae9b3bdf6c4d61d6f8248d Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 21:31:53 +0100 Subject: [PATCH 12/13] update check at startup --- papers/configs.py | 9 +++++---- papers/papers_cmd.py | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/papers/configs.py b/papers/configs.py index 391b1b0..25b80e4 100644 --- a/papers/configs.py +++ b/papers/configs.py @@ -15,17 +15,18 @@ DFT_PLUGINS = '' DFT_CONFIG = {'papers_dir' : os.path.expanduser('~/.papers'), 'doc_dir' : 'doc', - 'import_copy' : 'yes', - 'import_move' : 'no', - 'color' : 'yes', + 'import_copy' : True, + 'import_move' : False, + 'color' : True, 'version' : 3, + 'version_warning' : True, 'open_cmd' : 'open', 'edit_cmd' : DFT_EDIT_CMD, 'plugins' : DFT_PLUGINS } -BOOLEANS = {'import_copy', 'import_move', 'color'} +BOOLEANS = {'import_copy', 'import_move', 'color', 'version_warning'} # package-shared config that can be accessed using : diff --git a/papers/papers_cmd.py b/papers/papers_cmd.py index 5118bfb..cd1e138 100644 --- a/papers/papers_cmd.py +++ b/papers/papers_cmd.py @@ -9,6 +9,7 @@ from .ui import UI from . import configs from . import commands from . import plugins +from .__init__ import __version__ cmds = collections.OrderedDict([ ('init', commands.init_cmd), @@ -25,6 +26,26 @@ cmds = collections.OrderedDict([ ('update', commands.update_cmd), ]) +def _update_check(config, ui): + if config.version_warning: + code_version = int(__version__) + repo_version = int(config.version) + + if repo_version > code_version: + ui.print_('warning: your repository was generated with an newer version' + ' of papers (v{}) than the one you are using (v{}).\n'.format( + repo_version, code_version) + + ' you should not use papers until you install the ' + 'newest version. (use version_warning in you papersrc ' + 'to bypass this error)') + sys.exit() + elif repo_version < code_version: + ui.print_( + 'warning: your repository version (v{})'.format(repo_version) + + 'must be updated to version {}.\n'.format(code_version) + + "run 'papers update'.") + sys.exit() + def execute(raw_args = sys.argv): # loading config @@ -34,6 +55,8 @@ def execute(raw_args = sys.argv): ui = UI(config) + _update_check(config, ui) + # Extend with plugin commands plugins.load_plugins(ui, config.plugins.split()) for p in plugins.get_plugins().values(): From ab527856679ac25e1124f67366df97673b4f652b Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 4 Jul 2013 21:39:51 +0100 Subject: [PATCH 13/13] update test in test_usecases --- tests/test_usecase.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_usecase.py b/tests/test_usecase.py index 98abc7d..2a348ee 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -372,3 +372,13 @@ class TestUsecase(unittest.TestCase): with self.assertRaises(SystemExit): cmds[-1] == 'papers open Page8' _execute_cmds(cmds) + + def test_update(self): + cmds = ['papers init', + 'papers add -b data/pagerank.bib', + 'papers update' + ] + + with self.assertRaises(SystemExit): + _execute_cmds(cmds) +