diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..1a3267b --- /dev/null +++ b/changelog.md @@ -0,0 +1,70 @@ +# Changelog + + +## Current master + +[Full Changelog](https://github.com/pubs/pubs/compare/v0.7.0...master) + + +### Implemented enhancements + +- Better dialog after editing paper [(#142)](https://github.com/pubs/pubs/issues/142) + +- Add a command to open urls ([#139](https://github.com/pubs/pubs/issues/139) by [ksunden](https://github.com/ksunden)) + +- More robust cache on version change [(#138)](https://github.com/pubs/pubs/issues/138) + +- Allow utf8 citekeys [(#133)](https://github.com/pubs/pubs/issues/133) + +- Adds tag list completion in `pubs add -t ` [(#130)](https://github.com/pubs/pubs/issues/130) + +- Wider Travis coverage ([#107](https://github.com/pubs/pubs/issues/107) and [#108](https://github.com/pubs/pubs/issues/108)) + +- Uses bibtexparser bwriter instead of internal encoder and adds `--ignore-fields` option to export. [(#106)](https://github.com/pubs/pubs/issues/106) + +- Configurable alias descriptions ([#104](https://github.com/pubs/pubs/issues/104) by [wflynny](https://github.com/wflynny)) + +- Support year ranges in query [(#102)](https://github.com/pubs/pubs/issues/102) + + +### Fixed bugs + +- [[#148]](https://github.com/pubs/pubs/issues/148) Fix compatibility with Pyfakefs 3.7 [(#151)](https://github.com/pubs/pubs/pull/151) + +- [[#95]](https://github.com/pubs/pubs/issues/95) Error message when editor is missing [(#141)](https://github.com/pubs/pubs/issues/141) + +- Fixes tests for printing help on `--help` and without argument. [(#137)](https://github.com/pubs/pubs/issues/137) + +- [[#126]](https://github.com/pubs/pubs/issues/126) Removes journal customization [(#127)](https://github.com/pubs/pubs/issues/127) + +- Fixes Travis failure on installing python3 for OSX [(#125)](https://github.com/pubs/pubs/issues/125) + +- [[#119]](https://github.com/pubs/pubs/issues/119) Removes link and DOI customization. [(#124)](https://github.com/pubs/pubs/issues/124) + +- [[#122]](https://github.com/pubs/pubs/issues/122) Fixes common strings [(#123)](https://github.com/pubs/pubs/issues/123) + +- [[#28]](https://github.com/pubs/pubs/issues/28) allow utf8 in citekeys [(#120)](https://github.com/pubs/pubs/issues/120) + +- Fixes field orders to use 'url' and fixes broken test. [(#118)](https://github.com/pubs/pubs/issues/118) + +- [[#25]](https://github.com/pubs/pubs/issues/25) Fix bibtex testcase [(#117)](https://github.com/pubs/pubs/issues/117) + +- [[#103]](https://github.com/pubs/pubs/issues/103) Fixes unicode comparison [(#116)](https://github.com/pubs/pubs/issues/116) + +- [[#95]](https://github.com/pubs/pubs/issues/95) robust handling of DOIs ([#105](https://github.com/pubs/pubs/issues/105) by [wflynny](https://github.com/wflynny)) + +- [[#99]](https://github.com/pubs/pubs/issues/99) Print help when no subcommand is provided ([#100](https://github.com/pubs/pubs/issues/100) by [wflynny](https://github.com/wflynny)) + +- Fix defaults not used in config. [(#97)](https://github.com/pubs/pubs/issues/97) + +- Fixes content not read from urls because of call to `os.abspath` [(#96)](https://github.com/pubs/pubs/issues/96) + +- [[#93]](https://github.com/pubs/pubs/issues/93) actually save the modifications on `edit -m`. [(#94)](https://github.com/pubs/pubs/issues/94) + +- [[#88]](https://github.com/pubs/pubs/issues/88) Adds proper escaping for +arguments in alias plugin. [(#91)](https://github.com/pubs/pubs/issues/91) + + +## [v0.7.0](https://github.com/pubs/pubs/compare/v0.6.0...v0.7.0) (2017-08-06) + +[Full Changelog](https://github.com/pubs/pubs/compare/v0.6.0...v0.7.0) diff --git a/pubs/uis.py b/pubs/uis.py index 3c9aac6..9a39b32 100644 --- a/pubs/uis.py +++ b/pubs/uis.py @@ -11,11 +11,11 @@ import subprocess from . import color from . import config from .p3 import _get_raw_stdout, _get_raw_stderr, input, ustr -from .content import check_file, read_text_file, write_file, system_path +from .content import check_file, read_text_file, write_file DEBUG = False # unhandled exceptions traces are printed -DEBUG_ALL_TRACES = False # handled exceptions traces are printed +DEBUG_ALL_TRACES = False # handled exceptions traces are printed # package-shared ui that can be accessed using : # from uis import get_ui # ui = get_ui() @@ -45,7 +45,7 @@ def _get_local_editor(): def get_ui(): if _ui is None: - return PrintUI(config.load_default_conf()) # no editor support. (#FIXME?) + return PrintUI(config.load_default_conf()) # no editor support. (#FIXME?) return _ui @@ -85,7 +85,7 @@ class PrintUI(object): kwargs['file'] = self._stderr print('{}: {}'.format(color.dye_err('error', 'error'), message), **kwargs) - if DEBUG_ALL_TRACES: # if an exception has been raised, print the trace. + if DEBUG_ALL_TRACES: # if an exception has been raised, print the trace. if sys.exc_info()[0] is not None: traceback.print_exception(*sys.exc_info) @@ -159,7 +159,6 @@ class InputUI(PrintUI): pass self.message('Incorrect option.', option_str) - def input_choice(self, options, option_chars, default=None, question=''): """Ask the user to chose between a set of options. The user is asked to input a char corresponding to the option he chooses. diff --git a/readme.md b/readme.md index 1129229..4b03dcd 100644 --- a/readme.md +++ b/readme.md @@ -125,3 +125,4 @@ You can access the self-documented configuration by using `pubs conf`, and all t - [Tyler Earnest](https://github.com/tmearnest) - [Dennis Wilson](https://github.com/d9w) - [Bill Flynn](https://github.com/wflynny) +- [ksunden](https://github.com/ksunden) diff --git a/tests/fake_env.py b/tests/fake_env.py index 2bc9a51..d099a79 100644 --- a/tests/fake_env.py +++ b/tests/fake_env.py @@ -107,11 +107,16 @@ class TestFakeFs(fake_filesystem_unittest.TestCase): def setUp(self): self.rootpath = os.path.abspath(os.path.dirname(__file__)) + self.homepath = os.path.expanduser('~') self.setUpPyfakefs() - self.fs.CreateDirectory(os.path.expanduser('~')) - self.fs.CreateDirectory(self.rootpath) - os.chdir(self.rootpath) + self.reset_fs() def reset_fs(self): - self._stubber.tearDown() # renew the filesystem - self.setUp() + """Reset the fake filesystem""" + for dir_name in self.fs.listdir('/'): + if dir_name not in ['var', 'tmp']: + self.fs.remove_object(os.path.join('/', dir_name)) + + self.fs.create_dir(os.path.expanduser('~')) + self.fs.create_dir(self.rootpath) + os.chdir(self.rootpath) diff --git a/tests/requirements.txt b/tests/requirements.txt index 2790d94..f3726e3 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,5 +1,5 @@ # those are the additional packages required to run the tests six -pyfakefs==3.3 +pyfakefs ddt mock diff --git a/tests/test_bibstruct.py b/tests/test_bibstruct.py index 7d56feb..05af028 100644 --- a/tests/test_bibstruct.py +++ b/tests/test_bibstruct.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -import os import unittest import copy diff --git a/tests/test_config.py b/tests/test_config.py index 23856a2..cecd75b 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -2,7 +2,7 @@ import unittest import dotdot -from pubs.config import conf +# from pubs.config import conf # class TestConfig(unittest.TestCase): # diff --git a/tests/test_databroker.py b/tests/test_databroker.py index 57e5c66..8891931 100644 --- a/tests/test_databroker.py +++ b/tests/test_databroker.py @@ -5,8 +5,7 @@ import os import dotdot import fake_env -from pubs import content, filebroker, databroker, datacache -from pubs.config import conf +from pubs import content, databroker, datacache import str_fixtures from pubs import endecoder @@ -35,7 +34,7 @@ class TestDataBroker(fake_env.TestFakeFs): self.assertEqual(db.pull_metadata('citekey1'), page99_metadata) pulled = db.pull_bibentry('citekey1')['Page99'] - for key, value in pulled.items(): + for key in pulled.keys(): self.assertEqual(pulled[key], page99_bibentry['Page99'][key]) self.assertEqual(db.pull_bibentry('citekey1'), page99_bibentry) @@ -91,4 +90,4 @@ class TestDataBroker(fake_env.TestFakeFs): if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/tests/test_datacache.py b/tests/test_datacache.py index 4709aca..bfb9223 100644 --- a/tests/test_datacache.py +++ b/tests/test_datacache.py @@ -3,7 +3,6 @@ import unittest import time import dotdot -import fake_env from pubs.datacache import CacheEntrySet diff --git a/tests/test_pretty.py b/tests/test_pretty.py index 0d2cf23..0c09211 100644 --- a/tests/test_pretty.py +++ b/tests/test_pretty.py @@ -1,10 +1,8 @@ from __future__ import unicode_literals import unittest -import os import dotdot -import fake_env from pubs import endecoder, pretty, color, config diff --git a/tests/test_usecase.py b/tests/test_usecase.py index f9ae4e4..43cbf2c 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -15,14 +15,12 @@ from pyfakefs.fake_filesystem import FakeFileOpen import dotdot import fake_env -from pubs import pubs_cmd, update, color, content, filebroker, uis, p3, endecoder +from pubs import pubs_cmd, color, content, uis, p3, endecoder from pubs.config import conf -import configobj import str_fixtures import fixtures -from pubs.commands import init_cmd, import_cmd # makes the tests very noisy PRINT_OUTPUT = False @@ -68,10 +66,10 @@ class TestInput(unittest.TestCase): ui = uis.InputUI(sample_conf) other_input = fake_env.FakeInput(['yes', 'no'], - module_list=[uis, color]) + module_list=[uis]) other_input.as_global() - self.assertEqual(ui.editor_input(), 'yes') - self.assertEqual(ui.editor_input(), 'no') + self.assertEqual(ui.editor_input('fake_editor'), 'yes') + self.assertEqual(ui.editor_input('fake_editor'), 'no') with self.assertRaises(fake_env.FakeInput.UnexpectedInput): ui.editor_input() @@ -84,7 +82,6 @@ class CommandTestCase(fake_env.TestFakeFs): def setUp(self, nsec_stat=True): super(CommandTestCase, self).setUp() os.stat_float_times(nsec_stat) - # self.fs = fake_env.create_fake_fs([content, filebroker, conf, init_cmd, import_cmd, configobj, update], nsec_stat=nsec_stat) self.default_pubs_dir = os.path.expanduser('~/.pubs') self.default_conf_path = os.path.expanduser('~/.pubsrc') @@ -180,7 +177,7 @@ class URLContentTestCase(DataCommandTestCase): return p3.urlparse(url).path def url_exists(self, url): - return self.fs.Exists(self._url_to_path(url)) + return self.fs.exists(self._url_to_path(url)) def url_to_byte_content(self, url, ui=None): path = self._url_to_path(url) @@ -974,4 +971,4 @@ class TestCache(DataCommandTestCase): if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2)