(temp_py_file)
| 133 | |
| 134 | |
| 135 | def test_running_file_with_root_check(temp_py_file): |
| 136 | content = cf.get_file_content(temp_py_file.name) |
| 137 | chain = setup_state("", "", pec="") |
| 138 | |
| 139 | with tempfile.TemporaryDirectory() as d: |
| 140 | with ChDir(d): |
| 141 | chain.check_file( |
| 142 | temp_py_file.name, solution_code=content |
| 143 | ).run().check_object("a").has_equal_value() |
| 144 | |
| 145 | with tempfile.TemporaryDirectory() as d: |
| 146 | with ChDir(d): |
| 147 | chain.check_file( |
| 148 | temp_py_file.name, solution_code=content |
| 149 | ).run().has_no_error() |
| 150 | |
| 151 | with tempfile.TemporaryDirectory() as d: |
| 152 | with ChDir(d): |
| 153 | chain.check_file( |
| 154 | temp_py_file.name, solution_code=content |
| 155 | ).run().has_printout(0) |
| 156 | |
| 157 | with pytest.raises(TF): |
| 158 | with tempfile.TemporaryDirectory() as d: |
| 159 | with ChDir(d): |
| 160 | chain.check_file( |
| 161 | temp_py_file.name, solution_code="print('Bye!')" |
| 162 | ).run().has_printout(0) |
| 163 | |
| 164 | with tempfile.TemporaryDirectory() as d: |
| 165 | with ChDir(d): |
| 166 | chain.check_file(temp_py_file.name, solution_code=content).run().has_output( |
| 167 | "Hi" |
| 168 | ) |
nothing calls this directly
no test coverage detected