Commit Graph
69 Commits
Author SHA1 Message Date
Šarūnas Nejus f36bc497c8 Fix lint issues
- 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
2024-09-21 11:59:18 +01:00
Šarūnas Nejus 85a17ee503 Reformat the codebase 2024-09-21 11:57:48 +01:00
Šarūnas Nejus 4b69b493d2 Use f-string syntax 2024-08-16 17:47:23 +01:00
Šarūnas Nejus 847e3858a6 Replace assertRaises 2024-08-12 08:43:42 +01:00
Šarūnas Nejus 9a05d27acf Replace assertEqual 2024-08-12 08:43:42 +01:00
Šarūnas Nejus 6631b6aef6 Replace assertNotIn 2024-08-12 08:43:42 +01:00
Šarūnas Nejus 11e948121c Replace assertIn 2024-08-12 08:43:42 +01:00
Šarūnas Nejus 2616bcc950 Replace assertIsNotNone 2024-08-12 08:43:41 +01:00
Šarūnas Nejus 5d4911e905 Replace assertIsNone 2024-08-12 08:43:41 +01:00
Šarūnas Nejus cb82917fe0 Replace assertFalse 2024-08-12 08:43:41 +01:00
Šarūnas Nejus f042f5ad32 Leave a single source of truth for importer setup 2024-07-28 18:58:53 +01:00
Šarūnas Nejus 7e444db914 Rename _create_import_dir -> prepare_album_for_import 2024-07-28 18:58:53 +01:00
Šarūnas Nejus c2fdf9873d Synchronise ImportHelper._create_import_dir and TestHelper.create_importer implementations 2024-07-28 18:58:53 +01:00
Šarūnas Nejus fcff5d72af Remove def suite TestLoader definitions 2024-07-28 18:58:51 +01:00
Šarūnas Nejus 432da560e4 Create PluginTestCase to dedupe plugin setup 2024-07-28 18:58:35 +01:00
Šarūnas Nejus 2d5fd907c3 Remove redundant setup_beets and teardown_beets instructions 2024-07-28 18:58:34 +01:00
Šarūnas Nejus 91099d362e Deduplicate TerminalImportHelper and rename to TerminalImportMixin 2024-07-28 18:58:34 +01:00
Šarūnas Nejus 8373181e02 Create PluginImportTestCase in test_plugins
This involves making EventsTest use _create_import_dir from TestHelper.
2024-07-28 18:58:34 +01:00
Šarūnas Nejus 6c1e26acc9 Replace unittest.TestCase, TestHelper by BeetsTestCase 2024-07-28 18:58:34 +01:00
Šarūnas Nejus 82b1a0d01f test_plugins.py: dedupe setUp, tearDown usage
And most importantly, remove a redudant invocation of `setup_beets`
which left temporary directories hanging around without getting cleaned
up.
2024-07-12 20:32:18 +01:00
freddiewanah e0de6e1b89 refactor the test methods to avoid suboptimal asserts. 2024-04-08 21:39:25 +08:00
Lars Kruse 508d28f66b tests: move reusable test-related modules into the beets package
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.
2024-01-15 19:40:57 +01:00
Lars Kruse 2b99c12430 tests: move TerminalImportSessionSetup from tests.test_ui_importer to test.helper
This class is imported by some other test modules.
Thus, it should reside in a module, which is obviously used by other
tests.
2024-01-15 19:40:57 +01:00
Lars Kruse 7707e23456 tests: move reusable components from test.test_importer to test.helper
`ImportHelper` and `AutotagStub` are used in many tests.
Thus, they should reside in a module which is obviously used by multiple
tests.
2024-01-15 19:40:57 +01:00
Serene-Arc a6e5201ff3 Apply formatting tools to all files
This is 'the big one', which touches every file so that it all conforms
to the given standard.
2023-10-22 09:53:18 +10:00
Adrian Sampson cc0979692b Better mocking for getfullargspec
Seems much more straightforward this way?
2023-10-20 17:36:21 -04:00
Adrian Sampson a9e1b607c5 Fix inspect mocking
File this under "I have no idea how this *ever* worked"...
2023-10-20 17:07:35 -04:00
luzpaz 8419149c7a Fix various typos 2023-08-09 21:26:15 -04: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 Todos c6746ed399 Add a test for Beatport ID extraction 2023-03-08 18:29:04 +01:00
J0J0 Todos af600497ee Add a test for Deezer ID extraction 2023-03-08 18:28:41 +01:00
J0J0 Todos c1299f64a1 Add a test for Spotify metadata ID extraction 2023-03-08 18:22:54 +01: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
Carl Suster 546bf3af7e mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
Carl Suster 4be2e1b5e6 Remove beets.util.inspect wrapper 2019-04-02 10:22:47 +11:00
Adrian Sampson 8763be5423 Revert "Fix tests for new prompt order"
This reverts commit a357cc4e1a.

We no longer need the tests to change---I was able to fix the order by
bringing the "abort" action into the standard list of options.
2016-12-28 14:33:11 -05:00
Adrian Sampson a357cc4e1a Fix tests for new prompt order 2016-12-28 14:23:22 -05:00
Adrian Sampson ae5e55cad6 Always use syspath to construct MediaFile
Related to #1966. Previously, we used a `syspath` call inside MediaFile, which
probably wasn't right: the constructor should behave like `open` in that we
need to use pass an OS path.
2016-12-04 21:00:56 -05: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
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 6eb1de5405 fix linelengths from displayable_path 2016-06-10 04:08:59 -04:00
Johnny Robeson daac41668e use util.displayable_path in more tests 2016-06-10 03:54:39 -04:00
Johnny Robeson 330306bbe2 remove bytes casts from object/method resolution code 2016-05-30 23:21:24 -04: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
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 be8feedfe6 Removed unicode_literals from test_plugins 2016-02-24 07:49:18 +01:00
Diego Moreda b49426046a Fix unrestored AutotagStub on two TestCases
* Call AutotagStub.restore() during the tearDown of
test_mbsubmit.MBSubmitPluginTest and test_plugins.PromptChoicesTest,
which could potentially lead to other tests calling mocked versions
of autotag.mb.match_album, .match_track, .album_for_id and .track_for_id
instead of the real functions.
2016-01-22 21:33:33 +01:00
Jack Wilsdon 12cd5306b7 Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
Diego Moreda b7747013d3 Prompt event unit tests
* Add "before_choose_candidate" unit tests (PromptChoicesTest), containing
tests for checking the addition of choices to ui.input_options (album and
singletons), conflict resolution, and callback handling (regular and with
return value).
2015-12-16 19:23:27 +01: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