Commit graph

52 commits

Author SHA1 Message Date
Adrian Sampson
a88682e7bb Undo from _common import unittest indirection
This was a vestige from when we used to need the unittest2 library for pre-2.7
compatibility. Now that we require Python 2.7, we aren't using that library
and this indirection wasn't doing any good.
2016-11-26 18:46:44 -05:00
Nathan Dwek
2eae2d6d17 Merge pull request #2262 from beetbox/fix-2260
Convert: Don't prompt for confirmation if query result is empty
Fix #2260
2016-11-13 20:37:09 +01:00
nathdwek@laptop
a0a9f5a7a8 Fix typos in tests 2016-11-13 17:49:18 +01:00
nathdwek@laptop
8067d82be8 convert: test for #2260 2016-11-13 17:47:07 +01:00
Johnny Robeson
304df82361 rename/move ui._arg_encoding to util.arg_encoding
We use this for more than ui concerns, so it should be in util.

It is also no longer marked as a "private" method.
2016-08-04 17:16:11 -04:00
Johnny Robeson
8c1e9e0dd4 add missing displayable_paths to satisify python -bb 2016-07-03 23:52:05 -04:00
Johnny Robeson
ffa46a185c bytestring normalization
Make sure many/most strings that touch the filesystem are
converted explicitly to bytestrings rather than implictly.
2016-06-13 05:39:09 -04:00
Johnny Robeson
61695edc3b write file tags (for tag tests) in binary mode 2016-06-10 04:12:30 -04:00
Adrian Sampson
e71e17d924 Open image file as binary in tests 2016-06-02 10:17:02 -07:00
Adrian Sampson
f96aa24a79 Convert stub: use __future__ imports
Even tiny stubs can't escape the wrath of flake8!
2016-05-31 17:55:12 -07:00
Adrian Sampson
40369c6ab2 Move convert stub script to its own file 2016-05-31 17:50:54 -07:00
Adrian Sampson
469aee9848 Correctly encode arguments in tests 2016-05-31 15:32:09 -07:00
Adrian Sampson
9e27c9e5ac Fix duplicated argument in test 2016-05-31 15:19:34 -07:00
Adrian Sampson
17681145c2 Fix a too-long line 2016-05-31 13:52:27 -07:00
Adrian Sampson
6ff7271ea0 Refactor convert command tests
This lets us force the use of explicit path: queries on the command line
instead of implicit path queries. This is more robust and works on
Windows, which currently gets confused when path components start with
`c:`.
2016-05-31 13:46:44 -07:00
Adrian Sampson
33a4767eaf Portable mock command for testing convert plugin 2016-05-31 11:48:29 -07:00
Adrian Sampson
71b9fd785c Revert "Do __name__ comparison with bytes and not unicode"
This reverts commit 9c41c39913.
That commit used byte strings for the `if __name__ == '__main__'` pattern,
which was necessary when we were doing unicode_literals. But it is wrong on
Python 3, and now that we're liberated from unicode_literals, we need to go
back to native strings for this comparison.
2016-05-29 19:19:59 -07:00
Jack Wilsdon
b1c58e99ec Update code to match pep8 naming standards 2016-04-27 20:15:10 +01:00
Adrian Sampson
e54c7eec3d Standardize __future__ imports without parentheses
Since the list is short enough now, we don't need parentheses for the line
wrap. This is a little less ugly.
2016-02-28 15:03:51 -08:00
Peter Kessen
14fc530200 Removed unicode_literals from test_convert 2016-02-22 07:47:06 +01:00
Jesse Weinstein
72ce9ea3eb use underscore in name for pep-8s sake 2016-01-12 22:14:12 -08:00
Jesse Weinstein
d93f723263 Convert SKIP_SLOW_TESTS to its own decorator 2016-01-12 21:53:52 -08:00
Jesse Weinstein
760298b8e4 Mark slow tests to be skipped if SKIP_SLOW_TESTS env var is defined
Saves over 100 seconds.
2016-01-10 23:18:47 -08:00
Jack Wilsdon
12cd5306b7 Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
Adrian Sampson
eb68177fee Fix #1735: convert --pretend encoding error 2015-11-21 12:40:45 -08:00
Peter Kessen
3eb8008b11 added encoding as comment in files
added line like
# -*- coding: utf-8 -*-
to all files with correct license in header
2015-11-19 18:41:01 +01:00
Adrian Sampson
07242f65e2 Convert always uses bytestring args (#1461) 2015-05-19 16:38:08 -07:00
Bruno Cauet
9c41c39913 Do __name__ comparison with bytes and not unicode 2015-01-20 12:03:57 +01:00
Bruno Cauet
2dab8e5fd6 Import unicode_literals in beets package 2015-01-19 21:41:33 +01:00
Bruno Cauet
90b388b775 Use __future__ imports but unicode_literals everywhere
Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.

Goal is smoothing the transition to python 3.
2015-01-19 12:25:16 +01:00
Bruno Cauet
2902cda036 tests: use absolute imports everywhere 2015-01-19 12:25:15 +01:00
Frederik “Freso” S. Olesen
4b1f0cbf48 Happy 2015. ;)
See 7a410f636b

Command used:

    git grep -l 'Copyright 201'|xargs sed -i -E 's/Copyright 201./Copyright 2015/'`
2015-01-08 21:37:09 +01:00
Adrian Sampson
b15102608c Fix convert tests
Use some shell trickery to get the pipelined command to work.
2014-12-21 09:50:57 -05:00
Thomas Scholtes
56aba87fdc convert: Test skip existing files
Reproduces #970
2014-09-18 17:01:17 +02:00
Thomas Scholtes
9a732fbd26 Converted files are tagged and checked in tests
The conversion function either copies files or runs the conversion
command on them, depending on the result of the `should_transcode()`
function. This commit makes the tests more sensitive to these cases.
2014-09-14 12:17:05 +02:00
Thomas Scholtes
9e9f645e59 convert: add cli flag to skip confirmation
The flag mirrors the `--yes` flag from the modify command.
2014-09-14 11:46:24 +02:00
Thomas Scholtes
75a28de543 Extend and refactor 'never_convert_lossy_files' tests
* Each test function only uses on fixture, so we create fixtures in the
  test functions and not in the `setup()` method.

* We test the effect of the option set to true and false.
2014-09-14 11:35:01 +02:00
Thomas Scholtes
a37cabb969 Make 'never_convert_lossy_files' tests more meaningful
We should expect the original file extensions to be preserved since we
do not transcode lossy files. The tests now fail, but a fix is coming
up.
2014-09-14 11:17:43 +02:00
Simon Kohlmeyer
ee6f3dba1b fix coding style errors 2014-09-13 19:51:23 +02:00
Simon Kohlmeyer
9d55179d2d Added never_convert_lossy_files option to convert plugin
When set to true, this config option chooses copying over converting when the
source file is in a lossy format. At the moment, everything except ape, flac,
alac and wav is considered lossy.
2014-09-13 19:07:25 +02:00
Thomas Scholtes
29e4fde571 convert: Simplify format configuration.
We don't have to specify the extension. By default it is the same as
the format name.
2014-08-05 12:06:35 +02:00
Thomas Scholtes
b27409684e convert: Add --format option
This option allows the user to specify the format on the command line
instead of editing the configuration.

The commit also includes some refactoring. In particular adding
arguments to functions to avoid dependence on global state.

Doc and Changelog in next commit
2014-08-05 10:45:32 +02:00
Thomas Scholtes
f19fa1567e Test converter embeds album art 2014-06-02 17:09:16 +02: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
7639267f8f Pythonic names for test helpers 2014-04-12 11:24:47 -07:00
Thomas Scholtes
65fcb8a28c Allow CLI tests to use :memory: db
This significantly increases performance
2014-04-12 16:08:57 +02:00
Thomas Scholtes
9d9f1b539f More robust tests for converted files 2014-04-09 20:41:58 +02:00
Thomas Scholtes
43f94ab7e6 Test convert on import 2014-04-08 01:22:02 +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