Skip to content

Commit b0ffc03

Browse files
author
perrette
committed
80% coverage reached #48
1 parent e91f13a commit b0ffc03

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

papers/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,9 @@ def check_install(parser, o, config):
402402

403403
install_doc = f"first execute `papers install --bibtex {config.bibtex or '...'} [ --local ]`"
404404
if not config.bibtex:
405-
parser.error(f"--bibtex must be specified, or {install_doc}")
405+
parser.print_help()
406+
print(f"--bibtex must be specified, or {install_doc}")
407+
raise PapersExit()
406408
elif not os.path.exists(config.bibtex):
407409
print(f'papers: error: no bibtex file found, do `touch {config.bibtex}` or {install_doc}')
408410
raise PapersExit()

tests/test_install.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,15 @@ def test_install_interactive4(self):
325325
self.assertFalse(config.git)
326326
self.assertFalse(config.gitlfs)
327327

328+
def test_install_interactive5(self):
329+
self.papers(f"""install --local --filesdir files --bibtex bibbib.bib << EOF
330+
y
331+
332+
EOF""")
333+
config = Config.load(self._path(".papers/config.json"))
334+
self.assertTrue(config.git)
335+
self.assertFalse(config.gitlfs)
336+
328337

329338
class TestUndoGitLocal(TestBaseInstall):
330339

@@ -413,4 +422,31 @@ def test_undo(self):
413422

414423
self.papers(f'redo --bibtex {self.mybib} --files {self.filesdir}')
415424
biblio = Biblio.load(self._path(self.mybib), '')
416-
self.assertEqual(len(biblio.entries), 1)
425+
self.assertEqual(len(biblio.entries), 1)
426+
427+
428+
429+
class TestUninstall(LocalInstallTest):
430+
def test_uninstall(self):
431+
self.assertTrue(self._exists(".papers/config.json"))
432+
self.papers(f'uninstall')
433+
self.assertFalse(self._exists(".papers/config.json"))
434+
435+
436+
class TestUninstall2(GlobalInstallTest):
437+
def test_uninstall(self):
438+
self.assertTrue(self._exists(CONFIG_FILE))
439+
self.papers(f'install --force --local')
440+
self.assertTrue(self._exists(".papers/config.json"))
441+
self.assertTrue(self._exists(CONFIG_FILE))
442+
self.papers(f'uninstall')
443+
self.assertFalse(self._exists(".papers/config.json"))
444+
self.assertTrue(self._exists(CONFIG_FILE))
445+
446+
def test_uninstall(self):
447+
self.papers(f'install --force --local')
448+
self.assertTrue(self._exists(".papers/config.json"))
449+
self.assertTrue(self._exists(CONFIG_FILE))
450+
self.papers(f'uninstall --recursive')
451+
self.assertFalse(self._exists(".papers/config.json"))
452+
self.assertFalse(self._exists(CONFIG_FILE))

0 commit comments

Comments
 (0)