Skip to content

Conversation

@flying-sheep
Copy link
Member

PR Checklist

Description of changes

pytest’s fixtures can no longer be annotated with marks: https://docs.pytest.org/en/stable/deprecations.html#applying-a-mark-to-a-fixture-function

this was used in tests/tools/_distances/test_distances.py in an attempt to clarify the dependency of some fixtures on the distance test parameter

I switched this to the fixtures simply using the parameter directly.

@github-actions github-actions bot added the bug Something isn't working label Nov 10, 2025
@flying-sheep flying-sheep requested a review from Zethson November 10, 2025 09:11
Copy link
Member

@Zethson Zethson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much!

mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

pertpy/_logger.py:307: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/tools/_distances/test_distances.py:33: error: Incompatible types in assignment (19 tuple items are incompatible; 16 items are omitted)  [assignment]
tests/tools/_distances/test_distances.py:33: note: Expression tuple item 0 has type "str"; "Literal['edistance', 'euclidean', 'root_mean_squared_error', 'mse', 'mean_absolute_error', 'pearson_distance', 'spearman_distance', 'kendalltau_distance', 'cosine_distance', 'r2_distance', 'mean_pairwise', 'mmd', 'wasserstein', 'sym_kldiv', 't_test', 'ks_test', 'nb_ll', 'classifier_proba', 'classifier_cp', 'mean_var_distribution', 'mahalanobis']" expected; 
tests/tools/_distances/test_distances.py:33: note: Expression tuple item 1 has type "str"; "Literal['edistance', 'euclidean', 'root_mean_squared_error', 'mse', 'mean_absolute_error', 'pearson_distance', 'spearman_distance', 'kendalltau_distance', 'cosine_distance', 'r2_distance', 'mean_pairwise', 'mmd', 'wasserstein', 'sym_kldiv', 't_test', 'ks_test', 'nb_ll', 'classifier_proba', 'classifier_cp', 'mean_var_distribution', 'mahalanobis']" expected; 
tests/tools/_distances/test_distances.py:33: note: Expression tuple item 2 has type "str"; "Literal['edistance', 'euclidean', 'root_mean_squared_error', 'mse', 'mean_absolute_error', 'pearson_distance', 'spearman_distance', 'kendalltau_distance', 'cosine_distance', 'r2_distance', 'mean_pairwise', 'mmd', 'wasserstein', 'sym_kldiv', 't_test', 'ks_test', 'nb_ll', 'classifier_proba', 'classifier_cp', 'mean_var_distribution', 'mahalanobis']" expected; 
tests/tools/_distances/test_distances.py:135: error: Incompatible types in assignment (expression has type "Distance", variable has type "Literal['edistance', 'euclidean', 'root_mean_squared_error', 'mse', 'mean_absolute_error', 'pearson_distance', 'spearman_distance', 'kendalltau_distance', 'cosine_distance', 'r2_distance', 'mean_pairwise', 'mmd', 'wasserstein', 'sym_kldiv', 't_test', 'ks_test', 'nb_ll', 'classifier_proba', 'classifier_cp', 'mean_var_distribution', 'mahalanobis']")  [assignment]
tests/tools/_distances/test_distances.py:136: error: Item "str" of "Literal['edistance', 'euclidean', 'root_mean_squared_error', 'mse', 'mean_absolute_error', 'pearson_distance', 'spearman_distance', 'kendalltau_distance', 'cosine_distance', 'r2_distance', 'mean_pairwise', 'mmd', 'wasserstein', 'sym_kldiv', 't_test', 'ks_test', 'nb_ll', 'classifier_proba', 'classifier_cp', 'mean_var_distribution']" has no attribute "pairwise"  [union-attr]
tests/tools/_distances/test_distances.py:220: error: Argument "mode" to "compare_distance" of "Distance" has incompatible type "Literal['new_mode']"; expected "Literal['simple', 'scaled']"  [arg-type]

mypy has some complaints now. Let me know if you want me to have a look at them.

@flying-sheep flying-sheep requested a review from Zethson November 10, 2025 11:25
Copy link
Member

@Zethson Zethson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

@Zethson Zethson merged commit 35bb64d into main Nov 10, 2025
16 of 17 checks passed
@Zethson Zethson deleted the pa/fix-fixtures branch November 10, 2025 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pytest 7.4 deprecates using marks on fixtures

3 participants