Skip to content

Commit

Permalink
Use the standard library's enterContext
Browse files Browse the repository at this point in the history
It looks like it was added in python 3.11, so there isn't much reason to
use absl's enter_context anymore.
  • Loading branch information
dseomn committed Nov 4, 2023
1 parent 7d395fd commit 58aaa9a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions rock_paper_sand/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

class ConfigTest(parameterized.TestCase):
def _config_with_null_session(self) -> config.Config:
session = self.enter_context(network.null_requests_session())
session = self.enterContext(network.null_requests_session())
return config.Config.from_config_file(
wikidata_session=session,
justwatch_session=session,
Expand Down Expand Up @@ -77,7 +77,7 @@ def test_invalid_config(
error_regex: str,
error_notes: Sequence[str],
) -> None:
self.enter_context(
self.enterContext(
flagsaver.flagsaver(
(
flags_and_constants.CONFIG_FILE,
Expand Down Expand Up @@ -227,7 +227,7 @@ def test_lint(
config_data: Any,
expected_results: Any,
) -> None:
self.enter_context(
self.enterContext(
flagsaver.flagsaver(
(
flags_and_constants.CONFIG_FILE,
Expand Down
2 changes: 1 addition & 1 deletion rock_paper_sand/state_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def setUp(self) -> None:
/ "new-dir"
/ "new-file.binpb"
)
self.enter_context(
self.enterContext(
flagsaver.flagsaver(
(flags_and_constants.STATE_FILE, str(self._state_path))
)
Expand Down
2 changes: 1 addition & 1 deletion rock_paper_sand/subcommand_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_container_runs_subcommand(self) -> None:

def test_container_prints_help(self) -> None:
parser = argparse.ArgumentParser()
mock_print_help = self.enter_context(
mock_print_help = self.enterContext(
mock.patch.object(
parser, "print_help", autospec=True, spec_set=True
)
Expand Down

0 comments on commit 58aaa9a

Please sign in to comment.