Skip to content

Commit 5f1a8fa

Browse files
committed
Fix: refactor TestOpponent class to resolve PytestCollectionWarning
- Changed TestOpponent class to no longer use __init__ constructor - This fixes the PytestCollectionWarning in axelrod/tests/strategies/test_player.py:353 - This modification allows the test to run without issues. See also: #1440
1 parent 4be07a7 commit 5f1a8fa

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

CHANGES.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# v4.13.2, 2025-01-06
2+
3+
Mainly internal changes: fix for `TestOpponent` class and updates to various files.
4+
5+
- Fixed `TestOpponent` class in `axelrod/tests/strategies/test_player.py` to remove the `__init__` constructor and replaced it with a static `strategy` method to resolve PytestCollectionWarning.
6+
- The class now defines a `strategy` method that returns `C`, as required for it to be collectable by pytest.
7+
8+
```python
9+
class OpponentTest(axl.Player):
10+
"""A player who only exists so we have something to test against"""
11+
12+
name = "OpponentTest"
13+
classifier = _test_classifier
14+
15+
@staticmethod
16+
def strategy(opponent):
17+
return C
18+
19+
- **Updated docs/Makefile**.
20+
- **Updated setup.py**.
21+
122
# v4.13.1, 2024-10-02
223

324
Mainly internal changes: move to pyproject.toml.

0 commit comments

Comments
 (0)