Commit graph

74 commits

Author SHA1 Message Date
wisp3rwind
9af9eb9b31 tests: make use of our custom filesystem assertions for conciseness
this replaces assertions of the form
    self.assertTrue(os.path.exists(syspath(path)))
by
    self.assertExists(path)
which includes the syspath conversion and is much easier to read.

Occurences where located using
    git grep -E 'assert(True|False).*(isdir|isfile|exist)'
2023-07-16 10:42:47 +02:00
wisp3rwind
1ef6b90786 add missing syspath conversions (1/3, tests)
these are mostly in the tests, which didn't cause issues since the
affected directories usually have nice ASCII paths. For consistency, it
is nicer to always invoke syspath. That also avoids deprecation warnings
for the bytestring interfaces on Python <= 3.5. The bytestring
interfaces were undeprecated with PEP 529 in Python 3.6, such that we
didn't observe any actual failures.
2023-06-24 14:52:46 +02:00
J0J0 T
e41525adbc convert: playlist: Remove clutter from test
- Remove comments in tearDown
- Don't test for converted.mp3, it's done in a separate test already, we
  only want to test for the playlist file here.
2023-03-29 07:21:27 +02:00
J0J0 T
9930a5da59 convert: playlist: Test playlist existence
Broken commit around writing a unittest that checks for existence of an
m3u file after convert has been called with --playlist option.
2023-03-29 07:21:27 +02:00
Aidan Epstein
c906e55ba9 Fix recent bug that would not transcode when format was wrong
Bug introduced in c6d623241b, should_transcode would return False even when the format was different.

Also fix up tests and documentation.
2022-10-19 08:55:51 -07:00
Jordi
c6d623241b Fix beets#4472 - set 'max_bitrate' default param to none 2022-10-01 01:20:30 +02:00
Adrian Sampson
c5e68f5643
Adapt to pycodestyle changes 2022-07-30 19:54:24 -04:00
Adrian Sampson
2b51b2443b
Remove a relevant test 2022-01-29 18:35:36 -05:00
mousecloak
0132067a29
Fix @unittest.skipIf annotations to ignore only win32 2022-01-07 21:29:44 -08:00
mousecloak
ec06694097
Makes the import converter respect the quiet and pretend flags.
When the delete_originals was set, beets would print the following, regardless
of the presence of the quiet parameter:

convert: Removing original file /path/to/file.ext

This commit ensures that the log is only printed when quiet is not present.
2022-01-07 21:29:43 -08:00
Andrew Rogl
9106b41a50 Remove as many as possible sys.version tests 2021-08-27 10:24:27 +10:00
Andrew Rogl
ee4268dabb Remove unused imports
Fix imports
Fix formatting
2021-08-26 20:59:48 +10:00
Andrew Rogl
1ec87a3bdd pyupgrade beetsplug and tests
All tests working
More tidy up to be done
2021-08-26 19:12:51 +10:00
Adrian Sampson
af1eaf5062
Merge remote-tracking branch 'origin/windows-ci' into drop-py2 2021-08-19 16:48:46 -04:00
Samuel Cook
b89a2650cc
Delete after convert (#3700)
* If import move is true, files will be deleted after converting.
Fixes #2947

* Removed trailing whitespace to comply with W293, fixing build

* Add period to the end of the comment

Co-Authored-By: Adrian Sampson <adrian@radbox.org>

* Added changelog entry for this fix.

* Added delete_originals option to remove source files after transcode

* Added unit test, removed redundant syspath call

Co-authored-by: Logan Arens <logan-arens@users.noreply.github.com>
Co-authored-by: Logan Arens <heresmygithub@protonmail.com>
Co-authored-by: Adrian Sampson <adrian@radbox.org>
Co-authored-by: Logan Arens <logan.arens@protonmail.com>
2020-08-03 20:20:20 -05:00
Jacob Pavlock
96b9e7caa5 skip broken windows tests 2020-08-03 13:42:59 -07:00
Carl Suster
546bf3af7e mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
Antonio Larrosa
85e0c0dcee Fixed E501 and E305 PEP8 errors 2017-04-04 09:08:30 +02:00
Antonio Larrosa
fa468ce9d1 Properly quote executable and command line parameter
Use shlex.quote (on python3) or pipes.quote (on python2) to properly
quote the python executable and parameter instead of using single quotes
2017-04-04 09:08:30 +02:00
Antonio Larrosa
44ddd2e8f5 Shell-escape sys.executable
sys.executable needs to be shell-escaped on windows.
2017-04-04 09:08:30 +02:00
Antonio Larrosa
42b4e54391 Use sys.executable instead of composing the executable name
Better use sys.executable than using sys.version_info.major and compose
the name of the python executable.
2017-04-04 09:08:30 +02:00
Antonio Larrosa
1e4378d636 Run python2 or python3 depending on what's used
On a system with dependencies installed for python3 but not for python2,
we have to make sure python3 is used everywhere since 'python' might be running
the python2 interpreter.

This helps with some problems in #2400, but doesn't fix the issue completely.
2017-04-04 09:08:30 +02:00
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