This involved many changes, some side effects of the change include:
- remove of all `u"abc"` forms, in favor of
`from __future__ import unicode_literals`. Their usage was
inconsistent anyway, leading to problems when mixing with
unicode content.
- improve the tests, to allow printing for usecase even when
crashing. Should make future test easier. This is done with a
rather hacky `StdIO` class in `p3`, but it works.
- for some reason, the skipped test for Python 2 seems to work
now. While the previous point might seem related, it is not clear
that this is actually the case.
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.
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
Actually the test not only is expected to fail but it misses a file
which causes an error instead of a failure on python 2. Should be
addressed by #25.
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
It depends on configobj, is cleaner and simpler than the previous implementation.
It adds comments in the config file, and type verification.
Related: #18
`print_out()` is replaced by `message()`, that redirect the output to
the stdout controlled by the PrintUI instance. Other than that, can be
used the same way as `print()`.
First this brings a change to the paper API: the terminology of bibdata
and bibentry is clarified: now bibentry is a dictionary of the form
{citekey: bibdata} where bibdata corresponds to the actual dictionary of
bibliographic fields and values {author: ..., year: ...}.
Now bibentry is an attribute of the paper object that is generated from
citekey and bibdata.
This commit fixes all tests in particular an issue with citekey in
bibentry not updated.
Also removes prints in tests and deprecated assertEquals.
Usecase tests now fail if the command ask for unexpected inputs.
Removes queries for user input in attach and add commands (for deletion
of a copied document file). The input was not coherent with tests and is
annoying.
Not so clean since trying to change stdout encoding requires accessing
sys.stdout.buffer, so fake_env has to mock this layer also. The basic
differences between p2 and p3 are handled in p3.py.
- Update fake_env for compatibility with io.
- Uniform open (through _my_open in content).
- Fix read issue for config (although still using SafeConfigParser that
is deprecated in py3).
- Document are added through repository method.
- Correct handling of the copy option.
- Does not check if document exists yet.
- Does not bypass copy=False if an url is given. Should it?
- Currently the document is actually pushed twice (not optimal).
Originally intended to fix a bug in edit openning fils with non-ascii
characters.
Now all data is assumed to be manipulated as unicode. Therefore all
values returned by functions from content are unicode. There are a few
exception in order to download non-unicode data without failing to
decode. These exception are marked by the 'byte_' prefix.
The io package is used instead of builtin open for all file
transactions.
The fake_env test helper has to be modified (hacked, to be honnest) since
fake_filesystem does not offer a mock of io.
This is still WIP. Two issues still have to be solved:
- first there is an UnicodeWarning raised by bibparser,
- also config is still directly using builtin open.
- edit command fails correctly on unknown citekey,
- init command and filebroker use content module to check paths,
- fix wrong docfile in testrepo,
- list command does not fail on None added date (unknown add dates are
older than everything else). Also adds relevant test.
The Repository rename_paper method has been updated. The citekey update
and syncronization with citekey in the bibdata should be handled in a
sane manner inside the Paper class.
* only bibtex format is supported
* all tests except test_repo.py and edit test pass
* edit and update commands were not updated
* removed --format argument from export, only bibtex is supported.
- Cleans code.
- Clever mode for case by default (case sensitive only if capitals in
query).
- Adds basic tests.
- Conjunction of blocks.
- Options to override smart case.