File tree Expand file tree Collapse file tree 3 files changed +376
-781
lines changed Expand file tree Collapse file tree 3 files changed +376
-781
lines changed Original file line number Diff line number Diff line change 63
63
HAVE_HARDLINK = sys .platform != "win32"
64
64
65
65
66
- def item (lib = None ):
67
- i = beets . library . Item (
66
+ def item (lib = None , ** kwargs ):
67
+ defaults = dict (
68
68
title = "the title" ,
69
69
artist = "the artist" ,
70
70
albumartist = "the album artist" ,
@@ -99,6 +99,7 @@ def item(lib=None):
99
99
album_id = None ,
100
100
mtime = 12345 ,
101
101
)
102
+ i = beets .library .Item (** {** defaults , ** kwargs })
102
103
if lib :
103
104
lib .add (i )
104
105
return i
Original file line number Diff line number Diff line change
1
+ import inspect
1
2
import os
2
3
3
4
import pytest
4
5
6
+ from beets .dbcore .query import Query
7
+
5
8
6
9
def skip_marked_items (items : list [pytest .Item ], marker_name : str , reason : str ):
7
10
for item in (i for i in items if i .get_closest_marker (marker_name )):
@@ -21,3 +24,20 @@ def pytest_collection_modifyitems(
21
24
skip_marked_items (
22
25
items , "on_lyrics_update" , "No change in lyrics source code"
23
26
)
27
+
28
+
29
+ def pytest_make_parametrize_id (config , val , argname ):
30
+ """Generate readable test identifiers for pytest parametrized tests.
31
+
32
+ Provides custom string representations for:
33
+ - Query classes/instances: use class name
34
+ - Lambda functions: show abbreviated source
35
+ - Other values: use standard repr()
36
+ """
37
+ if inspect .isclass (val ) and issubclass (val , Query ):
38
+ return val .__name__
39
+
40
+ if inspect .isfunction (val ) and val .__name__ == "<lambda>" :
41
+ return inspect .getsource (val ).split ("lambda" )[- 1 ][:30 ]
42
+
43
+ return repr (val )
You can’t perform that action at this time.
0 commit comments