diff --git a/mypyc/test/test_run.py b/mypyc/test/test_run.py index ee9cdf176af9..9c7c48aa69ef 100644 --- a/mypyc/test/test_run.py +++ b/mypyc/test/test_run.py @@ -56,7 +56,7 @@ setup(name='test_run_output', ext_modules=mypycify({}, separate={}, skip_cgen_input={!r}, strip_asserts=False, - multi_file={}), + multi_file={}, opt_level='{}'), ) """ @@ -240,10 +240,16 @@ def run_case_step(self, testcase: DataDrivenTestCase, incremental_step: int) -> if incremental_step == 1: check_serialization_roundtrip(ir) + opt_level = int(os.environ.get('MYPYC_OPT_LEVEL', 0)) + setup_file = os.path.abspath(os.path.join(WORKDIR, 'setup.py')) # We pass the C file information to the build script via setup.py unfortunately with open(setup_file, 'w', encoding='utf-8') as f: - f.write(setup_format.format(module_paths, separate, cfiles, self.multi_file)) + f.write(setup_format.format(module_paths, + separate, + cfiles, + self.multi_file, + opt_level)) if not run_setup(setup_file, ['build_ext', '--inplace']): if testcase.config.getoption('--mypyc-showc'):