Skip to content

Commit

Permalink
switch to switch in tests too
Browse files Browse the repository at this point in the history
  • Loading branch information
hjwp committed Oct 30, 2024
1 parent eb879db commit 14148d8
Show file tree
Hide file tree
Showing 26 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion tests/test_appendix_DjangoRestFramework.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_listings_and_commands_and_output(self):
skip = False
if skip:
self.pos = 40
self.sourcetree.run_command('git checkout {}'.format(
self.sourcetree.run_command('git switch {}'.format(
self.sourcetree.get_commit_spec('ch36l027')
))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_appendix_Django_Class-Based_Views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_listings_and_commands_and_output(self):
skip = False
if skip:
self.pos = 27
self.sourcetree.run_command('git checkout {0}'.format(
self.sourcetree.run_command('git switch {0}'.format(
self.sourcetree.get_commit_spec('ch20l015')
))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_appendix_bdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_listings_and_commands_and_output(self):
skip = False
if skip:
self.pos = 27
self.sourcetree.run_command('git checkout {0}'.format(
self.sourcetree.run_command('git switch {0}'.format(
self.sourcetree.get_commit_spec('ch20l015')
))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_appendix_purist_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_listings_and_commands_and_output(self):
skip = False
if skip:
self.pos = 75
self.sourcetree.run_command('git checkout {0}'.format(
self.sourcetree.run_command('git switch {0}'.format(
self.sourcetree.get_commit_spec('ch19l041')
))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_appendix_rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_listings_and_commands_and_output(self):
skip = False
if skip:
self.pos = 40
self.sourcetree.run_command('git checkout {}'.format(
self.sourcetree.run_command('git switch {}'.format(
self.sourcetree.get_commit_spec('ch36l027')
))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_06_explicit_waits_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_listings_and_commands_and_output(self):
skip = False
if skip:
self.pos = 127
self.sourcetree.run_command('git checkout {}'.format(
self.sourcetree.run_command('git switch {}'.format(
self.sourcetree.get_commit_spec('ch06l036-2')
))

Expand Down
4 changes: 2 additions & 2 deletions tests/test_chapter_07_working_incrementally.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def test_listings_and_commands_and_output(self):
# self.pos = 93
self.pos = 113
self.sourcetree.run_command(
# "git checkout {}".format(self.sourcetree.get_commit_spec("ch07l035"))
"git checkout {}".format(self.sourcetree.get_commit_spec("ch07l041"))
# "git switch {}".format(self.sourcetree.get_commit_spec("ch07l035"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch07l041"))
)

while self.pos < touch_pos:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_08_prettification.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 55
self.sourcetree.run_command(
"git checkout {}".format(self.sourcetree.get_commit_spec("ch08l018"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch08l018"))
)

while self.pos < len(self.listings):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_chapter_09_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def test_listings_and_commands_and_output(self):
# self.pos = 18
self.pos = 60
self.sourcetree.run_command(
# "git checkout {}".format(self.sourcetree.get_commit_spec("ch09l001"))
# "git checkout {}".format(self.sourcetree.get_commit_spec("ch09l003"))
"git checkout {}".format(self.sourcetree.get_commit_spec("ch09l008"))
# "git switch {}".format(self.sourcetree.get_commit_spec("ch09l001"))
# "git switch {}".format(self.sourcetree.get_commit_spec("ch09l003"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch09l008"))
)
print(f"Running in: {self.sourcetree.tempdir}")
# vm_restore = "MANUAL_2"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_10_production_readiness.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_listings_and_commands_and_output(self):
self.pos = 29
self.sourcetree.run_command("uv pip install gunicorn whitenoise")
self.sourcetree.run_command(
"git checkout {}".format(self.sourcetree.get_commit_spec("ch10l007"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch10l007"))
)

# if DO_SERVER_COMMANDS:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_11_server_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 42
self.sourcetree.run_command(
f"git checkout {self.sourcetree.get_commit_spec('ch08l003')}"
f"git switch {self.sourcetree.get_commit_spec('ch08l003')}"
)

# if DO_SERVER_COMMANDS:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_12_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 42
self.sourcetree.run_command(
f"git checkout {self.sourcetree.get_commit_spec('ch08l003')}"
f"git switch {self.sourcetree.get_commit_spec('ch08l003')}"
)

# if DO_SERVER_COMMANDS:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_13_organising_test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_listings_and_commands_and_output(self):
skip = False
if skip:
self.pos = 25
self.sourcetree.run_command('git checkout {}'.format(
self.sourcetree.run_command('git switch {}'.format(
self.sourcetree.get_commit_spec('ch11l011')
))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_14_database_layer_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 3
self.sourcetree.run_command(
"git checkout {}".format(self.sourcetree.get_commit_spec("ch13l001"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch13l001"))
)

while self.pos < len(self.listings):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_15_simple_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_listings_and_commands_and_output(self):
if skip:
self.pos = 48 # 31
self.sourcetree.run_command(
"git checkout {}".format(
"git switch {}".format(
# self.sourcetree.get_commit_spec('ch11l015')
self.sourcetree.get_commit_spec("ch14l023")
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_16_advanced_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 60
self.sourcetree.run_command(
"git checkout {}".format(self.sourcetree.get_commit_spec("ch15l020"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch15l020"))
)

while self.pos < len(self.listings):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_17_javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 10
self.sourcetree.run_command(
"git checkout {}".format(self.sourcetree.get_commit_spec("ch16l004"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch16l004"))
)

while self.pos < len(self.listings):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_19_spiking_custom_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 51
self.sourcetree.run_command(
"git checkout {}".format(self.sourcetree.get_commit_spec("ch18l026"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch18l026"))
)

while self.pos < len(self.listings):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_20_mocking_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 75
self.sourcetree.run_command(
"git checkout {}".format(self.sourcetree.get_commit_spec("ch19l037"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch19l037"))
)

while self.pos < len(self.listings):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_21_mocking_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 75
self.sourcetree.run_command(
"git checkout {}".format(self.sourcetree.get_commit_spec("ch19l037"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch19l037"))
)

while self.pos < len(self.listings):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_22_fixtures_and_wait_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 10
self.sourcetree.run_command(
"git checkout {}".format(self.sourcetree.get_commit_spec("ch17l004"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch17l004"))
)

while self.pos < len(self.listings):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_chapter_23_debugging_prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 10
self.sourcetree.run_command(
"git checkout {}".format(self.sourcetree.get_commit_spec("ch17l004"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch17l004"))
)

# if DO_SERVER_COMMANDS:
Expand All @@ -50,7 +50,7 @@ def test_listings_and_commands_and_output(self):
# print("hacking in code update on server")
# self.run_server_command(
# "cd /home/elspeth/sites/staging.ottg.co.uk"
# " && git checkout chapter_23_debugging_prod"
# " && git switch chapter_23_debugging_prod"
# " && git reset --hard origin/chapter_23_debugging_prod",
# )
# self.run_server_command(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_24_outside_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 28
self.sourcetree.run_command(
"git checkout {}".format(
"git switch {}".format(
self.sourcetree.get_commit_spec("ch19l011"),
)
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_25_CI.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_listings_and_commands_and_output(self):
if skip:
self.pos = 27
self.sourcetree.run_command(
"git checkout {0}".format(self.sourcetree.get_commit_spec("ch20l015"))
"git switch {0}".format(self.sourcetree.get_commit_spec("ch20l015"))
)

while self.pos < len(self.listings):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapter_26_page_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_listings_and_commands_and_output(self):
if os.environ.get("SKIP"):
self.pos = 7
self.sourcetree.run_command(
"git checkout {}".format(self.sourcetree.get_commit_spec("ch24l004"))
"git switch {}".format(self.sourcetree.get_commit_spec("ch24l004"))
)

while self.pos < len(self.listings):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sourcetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def setUp(self):
os.path.join(os.path.dirname(__file__), "testrepo")
)
self.sourcetree.start_with_checkout("chapter_17", "chapter_16")
self.sourcetree.run_command("git checkout test-start")
self.sourcetree.run_command("git switch test-start")
self.sourcetree.run_command("git reset")

def test_from_real_git_stuff(self):
Expand Down Expand Up @@ -128,7 +128,7 @@ def test_raises_if_wrong_file(self):

def _checkout_commit(self, commit):
commit_spec = self.sourcetree.get_commit_spec(commit)
self.sourcetree.run_command("git checkout " + commit_spec)
self.sourcetree.run_command("git switch " + commit_spec)
self.sourcetree.run_command("git reset")

def test_raises_if_too_many_files_in_commit(self):
Expand Down

0 comments on commit 14148d8

Please sign in to comment.