Repository: ASPP/pelita

Issue:
pytest warns about our TestPlayer
    WC1 /tmp/group1/test/test_drunk_player.py cannot collect test class 'TestPlayer' because it has a __init__ constructor

Maybe rename it?

Discussion:

Patch:
diff --git a/pelita/player/__init__.py b/pelita/player/__init__.py
index cf429bca..bedaae24 100644
--- a/pelita/player/__init__.py
+++ b/pelita/player/__init__.py
@@ -1,7 +1,7 @@
 
 from .base import AbstractTeam, SimpleTeam, AbstractPlayer
 
-from .base import (StoppingPlayer, TestPlayer, SpeakingPlayer,
+from .base import (StoppingPlayer, SteppingPlayer, SpeakingPlayer,
                    RoundBasedPlayer, MoveExceptionPlayer, InitialExceptionPlayer,
                    DebuggablePlayer)
 
diff --git a/pelita/player/base.py b/pelita/player/base.py
index f07bba65..0e578f2f 100644
--- a/pelita/player/base.py
+++ b/pelita/player/base.py
@@ -516,7 +516,7 @@ class SpeakingPlayer(AbstractPlayer):
         self.say("Going %r." % (move,))
         return move
 
-class TestPlayer(AbstractPlayer):
+class SteppingPlayer(AbstractPlayer):
     """ A Player with predetermined set of moves.
 
     Parameters


Test patch:
diff --git a/test/test_game_master.py b/test/test_game_master.py
index 2b164441..e943d70b 100644
--- a/test/test_game_master.py
+++ b/test/test_game_master.py
@@ -5,7 +5,7 @@ import collections
 
 from pelita.datamodel import CTFUniverse
 from pelita.game_master import GameMaster, ManhattanNoiser, PlayerTimeout
-from pelita.player import AbstractPlayer, SimpleTeam, StoppingPlayer, TestPlayer
+from pelita.player import AbstractPlayer, SimpleTeam, StoppingPlayer, SteppingPlayer
 from pelita.viewer import AbstractViewer
 
 
@@ -18,8 +18,8 @@ class TestGameMaster:
             #     . #  .  .#3#
             ################## """)
 
-        team_1 = SimpleTeam("team1", TestPlayer([]), TestPlayer([]))
-        team_2 = SimpleTeam("team2", TestPlayer([]), TestPlayer([]))
+        team_1 = SimpleTeam("team1", SteppingPlayer([]), SteppingPlayer([]))
+        team_2 = SimpleTeam("team2", SteppingPlayer([]), SteppingPlayer([]))
         game_master = GameMaster(test_layout, [team_1, team_2], 4, 200)
 
         assert game_master.game_state["team_name"][0] == ""
@@ -48,8 +48,8 @@ class TestGameMaster:
             #     . #  .  .#3#
             ################## """)
 
-        team_1 = SimpleTeam('team1', TestPlayer([]), TestPlayer([]))
-        team_2 = SimpleTeam('team2', TestPlayer([]), TestPlayer([]))
+        team_1 = SimpleTeam('team1', SteppingPlayer([]), SteppingPlayer([]))
+        team_2 = SimpleTeam('team2', SteppingPlayer([]), SteppingPlayer([]))
 
         game_master = GameMaster(test_layout, [team_1, team_2], 4, 200)
         game_master.set_initial()
@@ -64,7 +64,7 @@ class TestGameMaster:
             #2#####    #####1#
             #     . #  .  .#3#
             ################## """)
-        team_1 = SimpleTeam(TestPlayer([]), TestPlayer([]))
+        team_1 = SimpleTeam(SteppingPlayer([]), SteppingPlayer([]))
         with pytest.raises(ValueError):
             GameMaster(test_layout_4, [team_1], 4, 200)
 
@@ -76,9 +76,9 @@ class TestGameMaster:
             #     . #  .  .#3#
             ################## """)
 
-        team_1 = SimpleTeam(TestPlayer([]), TestPlayer([]))
-        team_2 = SimpleTeam(TestPlayer([]), TestPlayer([]))
-        team_3 = SimpleTeam(TestPlayer([]), TestPlayer([]))
+        team_1 = SimpleTeam(SteppingPlayer([]), SteppingPlayer([]))
+        team_2 = SimpleTeam(SteppingPlayer([]), SteppingPlayer([]))
+        team_3 = SimpleTeam(SteppingPlayer([]), SteppingPlayer([]))
 
         with pytest.raises(ValueError):
             GameMaster(test_layout_4, [team_1, team_2, team_3], 4, 200)
@@ -259,7 +259,7 @@ class TestGame:
             return universe
 
 
-        teams = [SimpleTeam(TestPlayer('>-v>>>')), SimpleTeam(TestPlayer('<<-<<<'))]
+        teams = [SimpleTeam(SteppingPlayer('>-v>>>')), SimpleTeam(SteppingPlayer('<<-<<<'))]
         gm = GameMaster(test_start, teams, number_bots, 200)
 
         gm.set_initial()
@@ -317,7 +317,7 @@ class TestGame:
         assert create_TestUniverse(test_sixth_round,
             black_score=gm.universe.KILLPOINTS, white_score=gm.universe.KILLPOINTS) == gm.universe
 
-        teams = [SimpleTeam(TestPlayer('>-v>>>')), SimpleTeam(TestPlayer('<<-<<<'))]
+        teams = [SimpleTeam(SteppingPlayer('>-v>>>')), SimpleTeam(SteppingPlayer('<<-<<<'))]
         # now play the full game
         gm = GameMaster(test_start, teams, number_bots, 200)
         gm.play()
@@ -380,7 +380,7 @@ class TestGame:
                 #0 . #
                 #.. 1#
                 ###### """)
-        teams = [SimpleTeam(FailingPlayer()), SimpleTeam(TestPlayer("^"))]
+        teams = [SimpleTeam(FailingPlayer()), SimpleTeam(SteppingPlayer("^"))]
 
         gm = GameMaster(test_layout, teams, 2, 1)
 
@@ -409,8 +409,8 @@ class TestGame:
         number_bots = 2
 
         teams = [
-            SimpleTeam(TestPlayer([(0,0)])),
-            SimpleTeam(TestPlayer([(0,0)]))
+            SimpleTeam(SteppingPlayer([(0,0)])),
+            SimpleTeam(SteppingPlayer([(0,0)]))
         ]
         gm = GameMaster(test_start, teams, number_bots, 200)
 
@@ -439,7 +439,7 @@ class TestGame:
         NUM_ROUNDS = 2
         # bot 1 moves east twice to eat the single food
         teams = [
-            SimpleTeam(TestPlayer('>>')),
+            SimpleTeam(SteppingPlayer('>>')),
             SimpleTeam(StoppingPlayer())
         ]
         gm = GameMaster(test_start, teams, 2, game_time=NUM_ROUNDS)
@@ -473,7 +473,7 @@ class TestGame:
 
         teams = [
             SimpleTeam(StoppingPlayer()),
-            SimpleTeam(TestPlayer('<<')) # bot 1 moves west twice to eat the single food
+            SimpleTeam(SteppingPlayer('<<')) # bot 1 moves west twice to eat the single food
         ]
         gm = GameMaster(test_start, teams, 2, game_time=NUM_ROUNDS)
 
@@ -533,7 +533,7 @@ class TestGame:
         )
         teams = [
             SimpleTeam(StoppingPlayer()),
-            SimpleTeam(TestPlayer('<<<'))
+            SimpleTeam(SteppingPlayer('<<<'))
         ]
         # bot 1 eats all the food and the game stops
         gm = GameMaster(test_start, teams, 2, 100)
@@ -566,7 +566,7 @@ class TestGame:
         )
         teams = [
             SimpleTeam(StoppingPlayer()),
-            SimpleTeam(TestPlayer('<<<'))
+            SimpleTeam(SteppingPlayer('<<<'))
         ]
         # bot 1 eats all the food and the game stops
         gm = GameMaster(test_start, teams, 2, 100)
@@ -710,8 +710,8 @@ class TestGame:
 
 
         teams = [
-            SimpleTeam(TestPlayer('>>>>')),
-            SimpleTeam(TestPlayer('<<<<'))
+            SimpleTeam(SteppingPlayer('>>>>')),
+            SimpleTeam(SteppingPlayer('<<<<'))
         ]
         gm = GameMaster(test_start, teams, number_bots, 4)
 
@@ -806,8 +806,8 @@ class TestGame:
         # the game lasts two rounds, enough time for bot 1 to eat food
         NUM_ROUNDS = 5
         teams = [
-            SimpleTeam(TestPlayer('>--->')),
-            SimpleTeam(TestPlayer('<<<<<')) # bot 1 moves west twice to eat the single food
+            SimpleTeam(SteppingPlayer('>--->')),
+            SimpleTeam(SteppingPlayer('<<<<<')) # bot 1 moves west twice to eat the single food
         ]
         gm = GameMaster(test_start, teams, 2, game_time=NUM_ROUNDS)
 
diff --git a/test/test_player_base.py b/test/test_player_base.py
index 96998f8d..75fdadae 100644
--- a/test/test_player_base.py
+++ b/test/test_player_base.py
@@ -8,7 +8,7 @@ from pelita import datamodel
 from pelita.datamodel import CTFUniverse, east, stop, west
 from pelita.game_master import GameMaster
 from pelita.player import (AbstractPlayer, SimpleTeam,
-                           RandomPlayer, StoppingPlayer, TestPlayer,
+                           RandomPlayer, StoppingPlayer, SteppingPlayer,
                            RoundBasedPlayer, SpeakingPlayer)
 
 
@@ -29,7 +29,7 @@ class TestAbstractPlayer:
             ################## """)
 
         player_0 = StoppingPlayer()
-        player_1 = TestPlayer('^<')
+        player_1 = SteppingPlayer('^<')
         player_2 = StoppingPlayer()
         player_3 = StoppingPlayer()
         teams = [
@@ -277,8 +277,8 @@ class TestAbstractPlayer:
         assert set(sim_uni.enemy_food(p1._index)) == {(4, 3), (4, 2)}
 
 
-class TestTestPlayer:
-    def test_test_players(self):
+class TestSteppingPlayer:
+    def test_stepping_players(self):
         test_layout = (
         """ ############
             #0  .  .  1#
@@ -287,8 +287,8 @@ class TestTestPlayer:
         movements_0 = [east, east]
         movements_1 = [west, west]
         teams = [
-            SimpleTeam(TestPlayer(movements_0), TestPlayer(movements_0)),
-            SimpleTeam(TestPlayer(movements_1), TestPlayer(movements_1))
+            SimpleTeam(SteppingPlayer(movements_0), SteppingPlayer(movements_0)),
+            SimpleTeam(SteppingPlayer(movements_1), SteppingPlayer(movements_1))
         ]
         gm = GameMaster(test_layout, teams, 4, 2)
 
@@ -311,8 +311,8 @@ class TestTestPlayer:
             ############ """)
         num_rounds = 5
         teams = [
-            SimpleTeam(TestPlayer('>v<^-)')),
-            SimpleTeam(TestPlayer('<^>v-)'))
+            SimpleTeam(SteppingPlayer('>v<^-)')),
+            SimpleTeam(SteppingPlayer('<^>v-)'))
         ]
         gm = GameMaster(test_layout, teams, 2, num_rounds)
         player0_expected_positions = [(1,1), (2,1), (2,2), (1,2), (1,1)]
@@ -334,8 +334,8 @@ class TestTestPlayer:
         movements_0 = [east, east]
         movements_1 = [west, west]
         teams = [
-            SimpleTeam(TestPlayer(movements_0), TestPlayer(movements_0)),
-            SimpleTeam(TestPlayer(movements_1), TestPlayer(movements_1))
+            SimpleTeam(SteppingPlayer(movements_0), SteppingPlayer(movements_0)),
+            SimpleTeam(SteppingPlayer(movements_1), SteppingPlayer(movements_1))
         ]
         gm = GameMaster(test_layout, teams, 4, 3)
 
@@ -512,19 +512,19 @@ class TestSimpleTeam:
         assert team0.team_name == "my team"
         assert len(team0._players) == 0
 
-        team1 = SimpleTeam("my team", TestPlayer([]))
+        team1 = SimpleTeam("my team", SteppingPlayer([]))
         assert team1.team_name == "my team"
         assert len(team1._players) == 1
 
-        team2 = SimpleTeam("my other team", TestPlayer([]), TestPlayer([]))
+        team2 = SimpleTeam("my other team", SteppingPlayer([]), SteppingPlayer([]))
         assert team2.team_name == "my other team"
         assert len(team2._players) == 2
 
-        team3 = SimpleTeam(TestPlayer([]))
+        team3 = SimpleTeam(SteppingPlayer([]))
         assert team3.team_name == ""
         assert len(team3._players) == 1
 
-        team4 = SimpleTeam(TestPlayer([]), TestPlayer([]))
+        team4 = SimpleTeam(SteppingPlayer([]), SteppingPlayer([]))
         assert team4.team_name == ""
         assert len(team4._players) == 2
 
@@ -535,7 +535,7 @@ class TestSimpleTeam:
                 ###### """
         )
         dummy_universe = CTFUniverse.create(layout, 4)
-        team1 = SimpleTeam(TestPlayer('^'))
+        team1 = SimpleTeam(SteppingPlayer('^'))
 
         with pytest.raises(ValueError):
             team1.set_initial(0, dummy_universe, {})
diff --git a/test/test_simplesetup.py b/test/test_simplesetup.py
index 1a1cb830..fafe8c43 100644
--- a/test/test_simplesetup.py
+++ b/test/test_simplesetup.py
@@ -5,7 +5,7 @@ import uuid
 import zmq
 
 import pelita
-from pelita.player import AbstractPlayer, SimpleTeam, TestPlayer
+from pelita.player import AbstractPlayer, SimpleTeam, SteppingPlayer
 from pelita.simplesetup import SimpleClient, SimpleServer, bind_socket, extract_port_range
 from pelita.player import RandomPlayer
 
@@ -61,8 +61,8 @@ class TestSimpleSetup:
         client1_address = server.bind_addresses[0].replace("*", "localhost")
         client2_address = server.bind_addresses[1].replace("*", "localhost")
 
-        client1 = SimpleClient(SimpleTeam("team1", TestPlayer("^>>v<")), address=client1_address)
-        client2 = SimpleClient(SimpleTeam("team2", TestPlayer("^<<v>")), address=client2_address)
+        client1 = SimpleClient(SimpleTeam("team1", SteppingPlayer("^>>v<")), address=client1_address)
+        client2 = SimpleClient(SimpleTeam("team2", SteppingPlayer("^<<v>")), address=client2_address)
 
         client1.autoplay_process()
         client2.autoplay_process()
@@ -92,7 +92,7 @@ class TestSimpleSetup:
             def _get_move(self, universe, game_state):
                 pass
 
-        client1 = SimpleClient(SimpleTeam("team1", TestPlayer("^>>v<")), address=client1_address)
+        client1 = SimpleClient(SimpleTeam("team1", SteppingPlayer("^>>v<")), address=client1_address)
         client2 = SimpleClient(SimpleTeam("team2", FailingPlayer()), address=client2_address)
 
         client1.autoplay_process()