63 Commits

Author SHA1 Message Date
Fabien C. Y. Benureau
2aad93b526 Simplify, update the testsuite
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.
2016-06-05 21:48:19 +02:00
Fabien Benureau
e5b898c5c2 Cache implemented
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
2016-01-23 02:03:02 +01:00
Fabien Benureau
620eef4ace Fix expectedFailure tests 2016-01-17 02:42:56 +01:00
Fabien Benureau
e979aae85b Better rename and error dialogue
info() messages now print on stdout. warning() and error() still
print on stderr.

Fix #50
2016-01-16 21:52:36 +01:00
Olivier Mangin
2d9fa9af94 Comments out failing test from #25. 2016-01-15 19:02:56 -05:00
Olivier Mangin
2720d13049 Moves test of config file creation to its own test. 2016-01-15 19:02:56 -05:00
Olivier Mangin
7f6dde2f0c Temporary fix ExpectedFailure does not handle SystemExit on python 2.
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.
2016-01-15 19:02:56 -05:00
Fabien Benureau
b2ebc67f5e Handle Unicode BOM in bibfile
In particular, xml2bib file created without the `-nb` options would trip bibtexparser.

Fixes #23
2015-12-20 22:20:01 +01:00
Fabien Benureau
3b0ba0bb3c Test for leading space in citekeys
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
2015-12-20 18:51:43 +01:00
Fabien Benureau
f843aebcbd Better handle utf-8 citekeys
Utf-8 citekeys generate errors in bibtexparser. Until this is fixed,
this commit replace the stack-trace by a clear error message.

related: #28
2015-12-16 16:38:40 +01:00
73
a926c4c654 adds a *doc add|remove|export|open* command; depricates commands *open* and *attach*; fixed typos in readme.md and uis; 2015-12-13 21:34:48 +01:00
Fabien Benureau
4b21fa1355 Fix handling of version in argument parser 2015-12-10 21:50:18 +01:00
73
2871588703 implements #19 2015-12-10 12:50:38 +01:00
Fabien Benureau
392ee0c3c1 Merge branch 'master' into feat/new_config
Add StringIO and BytesIO to FakeIO.
Fixes bytes/string problem in update()
2015-12-07 11:49:16 +01:00
Olivier Mangin
5480f79d8d Fixes ˇpubs tag citekey :sometagˇ not working.
Also adds a few tests for the tag command.
2015-12-04 23:20:19 -05:00
Fabien Benureau
93c54939b3 Rewritten config module
It depends on configobj, is cleaner and simpler than the previous implementation.
It adds comments in the config file, and type verification.

Related: #18
2015-12-04 20:49:05 +01:00
Fabien Benureau
4b3b2a23bd Improves interface of PrintUI
`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()`.
2015-12-03 16:09:54 +01:00
Fabien Benureau
cce9406670 new print ui, more robust colors 2015-12-02 16:36:27 +01:00
Olivier Mangin
67aac0a2d7 Adds move option to add and attach commands.
When set removes original document file after copy.
2015-05-07 13:55:08 +02:00
Olivier Mangin
de2a50eeb2 Fix tests and terminology.
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.
2015-05-07 13:17:44 +02:00
Olivier Mangin
f2125b4c19 Tags have to be printed in alphabetical order. 2014-09-11 18:47:11 +02:00
Olivier Mangin
0479636393 Fix issues with stdout and updates tests.
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.
2014-09-11 18:35:07 +02:00
Olivier Mangin
52813439dd Removes useless beets_ui and FIX input issue between python 2 and 3. 2014-09-11 18:35:07 +02:00
Olivier Mangin
136b8f83dc Fix fake_env, fix configparser issues, uniform 'open'.
- 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).
2014-09-11 18:35:07 +02:00
Olivier Mangin
4fd2e964b3 FIX bug in tag command (multiple line printed instead of one). 2014-05-22 18:41:26 +02:00
Olivier Mangin
89bf370902 Fails to add with existing citekey.
Also adds add usecase test and improves repository __contains__.
2014-04-28 20:08:05 +02:00
Olivier Mangin
39b2e4f912 Factorizes code for adding document.
- 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).
2014-04-28 19:45:06 +02:00
Olivier Mangin
506bb24e50 Many cleanup in unicode encoding.
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.
2014-04-23 21:28:20 +02:00
Fabien Benureau
84fd5d7649 fix #17 2014-04-20 02:41:30 +02:00
Olivier Mangin
bf2cce1c13 Only use print_function. 2014-04-19 18:09:46 +02:00
Olivier Mangin
ed16f0bb5b Fix undefined variable and remove 'added' time (set by repo.push_paper). 2014-04-19 16:55:37 +02:00
Olivier Mangin
91b3fc75bb Several bug fixes.
- 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.
2014-04-18 12:58:12 +02:00
Olivier Mangin
b71b602a50 FIX bug in color when color not activated.
_nodye does not support being called with arg instead of kwarg.
Also improves pretty print and adds related tests.
2014-04-17 19:37:28 +02:00
Olivier Mangin
07cb6f696c Adds back edit command.
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.
2014-04-16 18:47:14 +02:00
Olivier Mangin
c9e4f9788c Moves removing of 'id' to endecoder where it belongs. 2014-04-16 16:21:40 +02:00
Fabien Benureau
d3736e257b moving from pybtex to bibtextparser, fixed major regressions.
* 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.
2014-04-13 15:10:40 +02:00
Fabien Benureau
9243859294 updated test_usecase + fixed bug in import_cmd 2013-11-17 19:44:55 +01:00
Fabien Benureau
8d91545472 papers renamed 'pubs' 2013-11-14 04:40:29 +01:00
Fabien Benureau
1ad64d7859 notes cmd 2013-11-11 04:07:42 +01:00
Fabien Benureau
10fd0f86d6 only one usecase failing 2013-11-11 00:52:09 +01:00
Fabien Benureau
8c54b19207 updated import and added rename command 2013-11-10 19:35:21 +01:00
Olivier Mangin
e72f8fa7f2 Improves query handling for list command.
- 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.
2013-10-14 18:03:34 +02:00
Olivier Mangin
08811b842f Adds citekey argument to selectively import entries.
Also removes unused fatal argument from many_from_path and moves
printing of warning to the command.
2013-07-16 12:46:02 +02:00
jgrizou
0801b3882d Merge branch 'develop' into plug/texnote 2013-07-05 18:10:40 +02:00
jgrizou
9cc893d8a7 Added AddEvent 2013-07-05 17:41:48 +02:00
Olivier Mangin
d5247a6618 Refactors usecase.
Integrate helpers into TestCase sub-classes to make use of setUp
mechanism.
2013-07-05 14:42:07 +02:00
Fabien Benureau
ab52785667 update test in test_usecases 2013-07-04 21:39:51 +01:00
Fabien Benureau
145710b928 test for every command except websearch and update 2013-07-04 21:15:03 +01:00
Fabien Benureau
6c9d4a3a41 lot more test in test_usecase : every command used 2013-07-04 18:59:30 +01:00
Fabien Benureau
04fcb42338 tests can be run from root dir 2013-07-04 18:31:21 +01:00