Additionally, reverted FakeSystemExit subclassing Exception, but added
an explicit __init__ so that we can emulate the SystemExit.code
functionality without having to change the superclass.
Unittest just checks that both `pubs` and `pubs --help` raise a
`SystemExit` exception with error code 0. Due to how argparse
handles the `--help` keyword, this is the best way I could think to
provide test coverage without heavily modifying the parser structure
or the unittest infrastructure.
To ensure the `pubs` matches the behavior of `pubs --help`, it now
raises the same `SystemExit(0)` exception via `sys.exit(0)`. And
in order to catch it in the unittest, I had to modify the
`FakeSystemExit` behavior slightly.
Made subparsers not required in the main parser, but if no commands are parsed,
then the parser prints its help. When a command is present, the normal
functionality preserved.
Removed the single unittest that checks for this exact behavior.
Basically the validation takes care of setting results that
post-processing was relying on. Hence the validation should occur before
the postprocessing. It actually makes more sense to validate within
post-process.
The default behavior from the requests library is to use the guess from
chardet which is not always reliable while doi.org seems to always
return utf8 encoded data. It's unlikely that this changes without also
updating the header.
For now, the editor_input and edit_file functions do not make sense
outside of the context of an ui. Having them in the content module
was confusing. (See issue fixed by a600855.)
Replace the in-house stubbing by the facilities offered
by pyfakefs for running tests. We don't use `io.open`
anymore, because pyfakefs does not stub it correctly.
We rely on a patched version of pyfakefs, as a few bug
remain in the official repo.
The implementation is designed to be robust to filesystems having integers
or nanosecond stat time.
Added a requirements.txt file for the tests:
`pip install -r tests/requirements.txt` to install the necessary packages
to run the tests.
Fix#13, Fix#14
1. Removed the unicode wrapper around fake_env io
2. Overrided pyfakefs cStringIO with StringIO (Python 2.x)
3. copy_dir will copy file in binary file to the fake filesystem
*unless* they are bib, yaml, txt or md files
4. ui.handle_exception() conserve traceback
Numerous unicode subtelties required diving into pyfakefs and configobj
source code. Unicode on Python 2.x is the worst.
The default behavior for commands is now to only catch exceptions that
must be handled specifically. This includes outputting a context
dependant message, cleaning up, etc. All other exceptions will be
handled by the ui.
So previous commit 666941d471 broke the current pip version
of bibtexparser (0.6.2), which does not have a
homegeneize_fields keyword. My bad and fixed!
+ The colors name's are the number 0 through 255.
+ Old names still work.
+ Add `magenta` color, wrongly named `purple` before.
+ Adds `white`, `darkgrey`.
+ grey/gray spelling
Also removed italics as a default option for publisher.
Related: #44
- Fix the previous default to 'None' (the string 'None', not None)
in the config.
- Adds support for using the $EDITOR when none is defined in the condif.
- Use ui.editor instead of content.editor in the add commnand.
Without args.prog, AliasCommand fail. Alias is better documented
in the readme and initial config files.
Update will now only trigger with version bumps. And the plugins
section is not updated. Removes the --upgrade flag.
On Python 3, invoking `pubs` would display a stacktrace, because
the subparser was not required.
This commit also simplifies the parser code by using .set_default()
to specify which command should be run.
This prompted changes in the plugin code. The code is still not
functioning, but many fixes in this commit bring the code closer
to a working state.
Add a theme section in the configuration file to allow users to
set the colors used by different elements of the ui.
Improve the update mechanism so that incremental changes to the
configuration file can be incorporated.
The update is done transparently, and displays a warning message explaining the change.
All the update machinery has been moved to the new update module.