75 Commits

Author SHA1 Message Date
Sebastian Mohr
0568cc07b9 Enabled strict typing. 2026-04-20 20:55:47 +02:00
Sebastian Mohr
615bf9158e Ignore types files in coverage. 2026-04-20 20:55:47 +02:00
Šarūnas Nejus
e2e8e80ee7 Fix coverage measurement
I found that beetsplug/musicbrainz.py does not appear under https://app.codecov.io/gh/beetbox/beets/tree/master/beetsplug.

Setting coverage source as repo root should fix this.
2026-04-19 15:12:04 +01:00
Šarūnas Nejus
cedf81eb22 Type musicbrainz fully 2026-04-12 16:21:30 +01:00
Šarūnas Nejus
13ad15b83e Move pytest marker definitions to conftest.py
Replace static marker declarations in setup.cfg with dynamic
registration via pytest_configure hook in conftest.py.
2026-03-08 08:19:55 +00:00
Šarūnas Nejus
84df87c665 Upload test results to codecov 2025-08-09 15:27:17 +01:00
Šarūnas Nejus
3495a7ef36 Update mypy config
Remove 'files' configuration from the config to make sure that mypy runs
quicker when invoked from the editor (where ideally it should only check
the file being edited).

Remove 'disallow_any_generics' from the config since we already have
this configured centrally.

And finally, do not allow variable redefinitions.
2025-07-16 14:15:27 +01:00
Sebastian Mohr
178e27f11f Fixed imports for all tests and added a bit of stricter type checking. 2025-07-15 15:03:14 +02:00
Benedikt
43301c4caa fixup #5701 (#5745)
which added some mypy config to pyproject.toml, leading to mypy ignoring
setup.cfg
 (this shows up in CI output for #5701, but is not very visible
since we currently ignore mypy errors)

Related: https://github.com/beetbox/beets/pull/5728
2025-04-20 10:43:10 +02:00
Šarūnas Nejus
4da72cb5f8 Ignore _typing.py coverage 2025-02-20 03:47:04 +00:00
Šarūnas Nejus
916d40f86f Remove outdated namespace package definition and update docs
See https://realpython.com/python-namespace-package.

This setup is backwards-compatible, so plugins using the old
pkgutil-based setup will continue working fine.

This setup has an advantage where external plugins will now be able to
import modules from 'beetsplug' package for typing purposes. Previously,
mypy could not resolve these modules due to presence of `__init__.py`.
2025-01-30 12:20:11 +00:00
Šarūnas Nejus
06eac79c0d Centralize requests setup with requests.Session
Improve requests performance with requests.Session which uses connection
pooling for repeated requests to the same host.

Additionally, this centralizes request configuration, making sure that
we use the same timeout and provide beets user agent for all requests.
2025-01-27 08:50:49 +00:00
Šarūnas Nejus
35dcfe508a Configure integrated lyrics tests to only run on lyrics code changes 2025-01-19 01:48:03 +00:00
Šarūnas Nejus
6f41872a26 Remove unused logic from beets.test and exclude it from coverage
Fun fact: it was the coverage data that revealed that this logic is not
used.
2024-10-16 12:38:21 +01:00
Šarūnas Nejus
11fa6c7b3f Introduce integration_test marker and update testing docs 2024-09-21 13:26:05 +01:00
Šarūnas Nejus
f8ef22348b Replace flake8 by ruff 2024-09-21 11:28:43 +01:00
Šarūnas Nejus
8e237d62c8 Make LazyClassProperty / cached_classproperty reusable 2024-06-21 08:49:10 +01:00
Šarūnas Nejus
2800a323a2 Revert "Make queries fast, filter all flexible attributes (#5240)"
This reverts commit 143b9202f3, reversing
changes made to 8508a57d77.
2024-06-19 21:51:44 +01:00
Šarūnas Nejus
265e40b14e Make LazyClassProperty / cached_classproperty reusable 2024-06-16 14:20:07 +01:00
Šarūnas Nejus
6b63a3090d Remove flake8 docstrings and its exclusion rules (#5234) 2024-06-16 02:55:49 +01:00
Šarūnas Nejus
3e075f2a9a Add 'test-with-coverage' command
And do not measure coverage by default.
2024-06-15 23:52:18 +01:00
Šarūnas Nejus
fa788e2e5a Remove flake8-docstrings and its exclusion rules 2024-06-15 13:09:33 +01:00
Šarūnas Nejus
09b67c1da6 Ignore aura.py/flake8-docstrings 2024-06-14 20:12:19 +01:00
Šarūnas Nejus
347911cdee Introduce Poe the Poet task runner and define tasks.
This makes it easier for people to interact with the project in
a unified manner.
2024-06-10 13:46:25 +01:00
Šarūnas Nejus
c75f07a0da Define paths to lint in mypy configuration 2024-05-07 21:16:24 +01:00
Šarūnas Nejus
1713011089 Move mypy configuration to setup.cfg 2024-05-07 21:16:24 +01:00
Šarūnas Nejus
8b4983fe7c Add pytest and coverage configuration
Add `pytest-cov` which automatically measures coverage while tests are
executing and update tox and ci build configuration accordingly.

Add configuration for coverage:
  1. Enable analysing logical branches
  2. Save coverage details as HTML for local development use
  3. Configure the HTML output to include coverage context: on the
     right-hand side of each covered code line there is an expandable
     section which lists every test that ran that line.
2024-05-04 10:24:28 +01:00
Serene-Arc
35257c7cd0 Exclude flake8 rule for black compatibility 2024-03-01 15:34:50 +10: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
Serene-Arc
15d7d2a7f6 Make flake8 black compatible 2023-10-22 09:50:33 +10:00
Adrian Sampson
5dee3e6ef4 Ignore docs warnings in all test files
These references were out-of-date as of #4951. Not sure why we were
listing these individually in the first place; it's not like we want to
be strict about docstrings in tests...
2023-10-20 15:28:12 -04:00
tandy1000
7961cf3aaa Add autobpm plugin
This plugin uses librosa to automatically calculate the BPM for a track.
It is based on the keyfinder plugin, and rounds the BPM to an int.

Co-authored-by: Adrian Sampson <adrian@radbox.org>
2023-09-30 16:25:06 +01:00
Adrian Sampson
abc3dfbf42 Reformat flake8 config comments
A recent release of flake8 broke the syntax we were using for comments:
https://github.com/pycqa/flake8/issues/1689#issuecomment-1326319235

It requires comments to be on their own lines.
2022-11-28 07:58:01 -08:00
patrick-nicholson
c3829c52c8 Lint ignore. 2021-12-27 13:38:20 -05:00
patrick-nicholson
a3754f7592 Test failing due to unidentified argument processing issue; replacing with API calls gives expected results.
Fixed some linting issues.
2021-12-27 13:26:38 -05:00
Andrew Rogl
277f4e72d1 Remove unrequired flake8 checks 2021-08-27 08:26:07 +10:00
Andrew Rogl
e262766580 pyupgrade root 2021-08-25 15:27:16 +10:00
Adrian Sampson
8d3cfe46ed Ignore a new pep8-naming error
The new error <https://github.com/PyCQA/pep8-naming/pull/157> strikes me
as a little overzealous: while most exceptions are errors, there are
some Exception subclasses that are *not* properly considered errors
(e.g., when they're only a base class for other error classes).
2021-07-15 09:52:43 -04:00
Jacob Pavlock
4e93469421 fix missing docstring-convention declaration 2020-07-29 20:32:53 -07:00
Jacob Pavlock
019055c156 add docstring checks to flake8
currently ignore all errors on a per-file basis
2020-07-29 17:21:15 -07:00
Jacob Pavlock
52afd717aa remove docstring-convention and update comment 2020-07-11 19:10:04 -07:00
Jacob Pavlock
124c882b4d un-ignore E221 2020-07-11 18:33:08 -07:00
Jacob Pavlock
abad0f9c08 un-ignore flake8 E226, E242, E704
none of these required any code changes
2020-07-11 18:22:43 -07:00
Jacob Pavlock
1db46dfeb6 reformat flake8 errors 2020-07-11 18:15:41 -07:00
Jacob Pavlock
dabde74683 nose -> pytest and clean-up tox 2020-07-06 17:03:11 -07:00
Adrian Sampson
966108b72c Enable flake8 E226
This is the rule that prohibits `1+2` in favor of `1 + 2`. I didn't
realize it was disabled by default!
2018-08-13 10:37:45 -04:00
Adrian Sampson
7c9ce0da7a Ignore yet another new flake8 error
As described in PyCQA/pycodestyle#598, pycodestyle has exposed a new
error for "ambiguous variable names." I really wish this project were
less eager to add new warnings of questionable value that are enabled by
default...
2017-10-29 16:29:06 -04:00
zigarrre
e30513db9b Added the default ignore list of flake8
This fixes the W503 warnings and possibly other, unwanted errors and
warnings in the future.
2017-09-12 18:19:18 +02:00
Adrian Sampson
4c6bf782a2 Ignore a new flake8 style warning
It's always fun when the style checker suddenly decides something new is bad
style. :/
2016-11-16 12:01:37 -05:00
Johnny Robeson
08cd22834b add flake8-coding to our tox config
Now we can enforce that all py files have the coding magic comment with
utf-8.
2016-08-07 04:09:58 -04:00