@@ -1102,18 +1102,19 @@ def run(data: ConjectureData) -> None:
1102
1102
1103
1103
# self.test_runner can include the execute_example method, or setup/teardown
1104
1104
# _example, so it's important to get the PRNG and build context in place first.
1105
- with (
1106
- local_settings (self .settings ),
1107
- deterministic_PRNG (),
1108
- BuildContext (data , is_final = is_final ) as context ,
1109
- ):
1110
- # providers may throw in per_case_context_fn, and we'd like
1111
- # `result` to still be set in these cases.
1112
- result = None
1113
- with data .provider .per_test_case_context_manager ():
1114
- # Run the test function once, via the executor hook.
1115
- # In most cases this will delegate straight to `run(data)`.
1116
- result = self .test_runner (data , run )
1105
+ #
1106
+ # NOTE: For compatibility with Python 3.9's LL(1) parser, this is written as
1107
+ # three nested with-statements, instead of one compound statement.
1108
+ with local_settings (self .settings ):
1109
+ with deterministic_PRNG ():
1110
+ with BuildContext (data , is_final = is_final ) as context :
1111
+ # providers may throw in per_case_context_fn, and we'd like
1112
+ # `result` to still be set in these cases.
1113
+ result = None
1114
+ with data .provider .per_test_case_context_manager ():
1115
+ # Run the test function once, via the executor hook.
1116
+ # In most cases this will delegate straight to `run(data)`.
1117
+ result = self .test_runner (data , run )
1117
1118
1118
1119
# If a failure was expected, it should have been raised already, so
1119
1120
# instead raise an appropriate diagnostic error.
0 commit comments