Commit graph

745 commits

Author SHA1 Message Date
Thomas Scholtes
1f742130c4 Catch all archive extract errors and skip tests without unrar 2014-04-15 18:26:35 +02:00
Thomas Scholtes
68595ee09d Import rar archives 2014-04-15 18:24:09 +02:00
Thomas Scholtes
e3acdd0cc8 Import tar archives
Also refactors the importer code to make better use of ArchiveImportTask.
2014-04-15 18:24:08 +02:00
Thomas Scholtes
b783097329 Import zip archives
`beet import archive.zip` extracts the archive to a temporary directory and
imports the content.

The code is very hacky. To make it cleaner the `importer` module needs some
refactoring. One thing the code hints at is extending the `ImportTask` class.
2014-04-15 18:24:08 +02:00
Thomas Scholtes
770bee3583 Extract check for thrird party programs in tests 2014-04-15 18:23:55 +02:00
Thomas Scholtes
4b012e5ddf Import tests use TestHelper
Removes duplicate code, increases speed and makes some files clake8 clean.
2014-04-15 14:57:01 +02:00
Adrian Sampson
02036dd480 Merge pull request #686 from mook/master
`beet modify`: Treat arguments with : before = as queries, not modifications
2014-04-14 10:39:43 -07:00
Mook
12a5215afa beet modify: Add simple argument parsing tests. 2014-04-13 21:24:45 -07:00
Adrian Sampson
2f3ed3e450 avoid extra output in test mp3gain run 2014-04-13 20:41:58 -07:00
Adrian Sampson
77af4ce040 more test isolation (#670)
Doing test-specific cleanup in tearDown before general sandbox deletion helps
avoiding contamination of global state between tests when cleanup fails.

Current Windows status:

    Ran 1106 tests in 72.373s
    FAILED (SKIP=10, errors=13, failures=15)

Closer!
2014-04-13 13:57:22 -07:00
Adrian Sampson
8555fa7640 skip pyechonest tests when library not installed 2014-04-13 13:26:51 -07:00
Adrian Sampson
9dd4ad96bd syspath: correctly prefix Windows UNC paths
Identified while tackling #670, but this should actually solve some legitimate
problems with cataloging music on a network drive.
2014-04-13 13:19:03 -07:00
Adrian Sampson
77eddaa2d1 properly sandbox all tests
All filesystem writes are now to temporary directories. (Long ago, the policy
was to put temporary stuff in _RSRC, but that was a pretty bad idea.)
2014-04-12 19:29:29 -07:00
Adrian Sampson
5477a5d039 better tolerance in RG tests
The first fix avoids contaminating all future tests if the plugin fails to
load. The second skips the CLI backend tests when the appropriate tool is not
available (just as we do with the GStreamer tests).
2014-04-12 19:04:01 -07:00
Adrian Sampson
ed8002bed5 tests: close databases to avoid errors on Windows
Fixes #655 and makes progress on #670.
2014-04-12 15:00:17 -07:00
Adrian Sampson
e5d28e2171 lyrics is flake8-clean 2014-04-12 13:32:46 -07:00
Adrian Sampson
7fcd7daf7c lyrics: minor style/doc cleanup 2014-04-12 13:08:24 -07:00
Adrian Sampson
2dafaa2f0c Merge branch 'KraYmer-lyrics-enh-tests' 2014-04-12 12:58:20 -07:00
Adrian Sampson
7639267f8f Pythonic names for test helpers 2014-04-12 11:24:47 -07:00
Thomas Scholtes
650b49795b Add keyfinder plugin
Closes #662 and #279.
2014-04-12 18:44:38 +02:00
Thomas Scholtes
e5104784c6 Add captureStdout helper and mocks to some tests 2014-04-12 16:49:54 +02:00
Thomas Scholtes
65fcb8a28c Allow CLI tests to use :memory: db
This significantly increases performance
2014-04-12 16:08:57 +02:00
Fabrice Laporte
9a32ed5864 add lyrics plugin unit tests file 2014-04-12 12:30:15 +02:00
Thomas Scholtes
c01fc542ed Support for initial_key with EchoNest 2014-04-11 21:03:11 +02:00
Thomas Scholtes
1670cb4565 Flake8 fixes 2014-04-11 16:05:08 +02:00
Thomas Scholtes
6705c123cf Use helper for replaygain tests 2014-04-11 15:14:13 +02:00
Thomas Scholtes
75da27729c Zero also tests deleting rg_track_gain 2014-04-11 15:12:47 +02:00
Thomas Scholtes
287428e805 Use only valid media files as fixtures 2014-04-11 00:06:59 +02:00
Thomas Scholtes
7b954d9999 Remove null normalization for replaygain.
A `None` value for replagain fields is different from a `0.0` value [1].

[1]: https://github.com/sampsyo/beets/issues/157#issuecomment-39521322
2014-04-10 22:02:24 +02:00
geigerzaehler
2be1bdeb1f Merge pull request #660 from geigerzaehler/mediafile-delete-tags
Delete and handle nonexistant tags
2014-04-10 20:35:19 +02:00
Thomas Scholtes
f6f974ec87 Remove ITEM_* constants
We might consider renaming `Item._fields` to `Item.fields` since other parts of
beets use it as a replacement for `ITEM_KEYS`.

See also #650.
2014-04-10 17:11:21 +02:00
Thomas Scholtes
52dc84f43a Set literal not available in py26 2014-04-09 23:28:11 +02:00
Thomas Scholtes
a6839603cd Return None for missing tags.
Instead of returning a special "None value" if a tag does not exist, we return
none directly.
2014-04-09 23:28:11 +02:00
Thomas Scholtes
a114b67974 Remove all tags from empty.wma 2014-04-09 23:28:11 +02:00
Thomas Scholtes
663d91c4b2 Delete tags from media files 2014-04-09 23:28:11 +02:00
Thomas Scholtes
9d9f1b539f More robust tests for converted files 2014-04-09 20:41:58 +02:00
Adrian Sampson
323be89d4d fold OrderedEnum into autotag module
This puts the OrderedEnum generic class next to where it is actually used. It
also refers to the recipe it is taken from on docs.python.org. I also took the
opportunity to give this a capitalized name (since it's a proper type).
2014-04-08 17:10:50 -07:00
Adrian Sampson
443b8089d5 remove unnecessary IndexableEnum
This is not really critical since list(Type)[i] works just as well. This fixes
a couple other problems from the enum transition:
- The name of TYPES was not really consistent with its new role as an enum
  type. Renamed this ImageType.
- Fix a rather egregious bug in embedart (undefined reference to Image).
2014-04-08 16:59:50 -07:00
Adrian Sampson
1eb6ccf0ab Merge pull request #642 from ktkonrad/enum34
use the new python enum instead of hand-rolled version
2014-04-08 15:24:04 -07:00
Adrian Sampson
9a21f555be MediaFile.update() no longer writes files
You now call update() followed by save(). This is mainly because the
implementation no longer performs lazy updates, so the need to pair tag
setting and writing together was diminished. Benefits in cleanliness:
- No need to duplicate the id3v2 option.
- Exception handling can be more precise.
- More closely resembles dict.update().
2014-04-07 20:34:48 -07:00
Adrian Sampson
b3f31cbc0a rename Item.media_fields to _media_fields
Following the convention of the other field sets and such. This helps avoid
any confusion with user-specified fields (although it's unlikely people will
want to name a flexible field "media_fields" :).
2014-04-07 20:21:20 -07:00
Thomas Scholtes
43f94ab7e6 Test convert on import 2014-04-08 01:22:02 +02:00
Thomas Scholtes
55e5381bbd Merge branch 'extendable-mediafile'
Conflicts:
	beets/library.py
	docs/dev/plugins.rst
2014-04-07 23:49:29 +02:00
Thomas Scholtes
6eb497b21b Remove pathlib dependency 2014-04-07 18:33:12 +02:00
Thomas Scholtes
651bdf0acc Refactor convert plugin
* `encode()` raises an error when the command returns with non-zero exit
  status. We catch that in the higher-level conversion functions and skip to
  the next item without writing tags.

* Simplified the handling of the `keep_new` flag.
2014-04-07 18:24:59 +02:00
Thomas Scholtes
9d87a7fc02 Make convert --keep-new work again
Iincludes some more tests for the convert plugin. The test use the extended
TestHelper class and the new pathlib (see #621).
2014-04-07 18:07:43 +02:00
Yevgeny Bezman
2a6e5c7273 Merge branch 'replaygain-backends'
Conflicts:
	tox.ini
2014-04-06 08:45:35 +03:00
Adrian Sampson
c09bac603f dbcore: types translate null values on assignment
In preparation for #660, where we will allow MediaFile to expose None values
when tags are missing (and consume None to remove tags). This makes it
possible to hide nullness in the rest of beets by translating None to a
suitable zero-ish value on field assignment.

Types can of course opt out of this to preserve a distinct null value. We do
this now for the album_id field, which needs to be null to indicate
singletons.

Type.normalize() also enables more sophisticated translations (e.g., an
integer field could round off float values assigned into it) in the future.
2014-04-05 16:27:07 -07:00
Thomas Scholtes
0a08696add Test convert error during import
When the conversion of an audio file fails during import the original should be
imported. See #659
2014-04-05 21:09:12 +02:00
Thomas Scholtes
41708865f5 Add helper for high-level tests 2014-04-05 21:09:12 +02:00