- Fix imports
- Fix pytest issues
- Do not assign lambda as variable
- Use isinstance instead of type to check type
- Rename ambiguously named variables
- Name custom errors with Error suffix
A couple of `ConfigTest` would previously fail locally since they
somehow depended on the local environment to work fine. This commmit
decouples them from any environment by setting up patching of the
environment variables properly.
External Python packages interfacing beets may want to use an in-memory
beets library instance for testing beets-related code.
The `TestHelper` class is very helpful for this purpose.
Previously `TestHelper` was located in the `test/` directory.
Now it is part of `beets` itself (`beets.test.helper.TestHelper`) and
can be easily imported.
Improve the split_into_lines regex and whitespace handling
so that spaces are handled and colored text can be wrapped
Create a new test suite for the color splitting function as
it was previously introducing rogue escape characters when
splitting colorized words.
- Allow user to change UI colors in config file.
- "Change Representation" class allows Albums and Track
matches to reuse similar formatting code
- Functions to split text into lines for printing
- Tests for the new UI to check wrapping functions
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)'
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.