(temp_py_file)
| 96 | |
| 97 | |
| 98 | def test_running_file(temp_py_file): |
| 99 | content = cf.get_file_content(temp_py_file.name) |
| 100 | chain = setup_state("", "", pec="") |
| 101 | |
| 102 | with tempfile.TemporaryDirectory() as d: |
| 103 | with ChDir(d): |
| 104 | chain.check_file( |
| 105 | temp_py_file.name, solution_code=content |
| 106 | ).run().has_equal_value(expr_code="a") |
| 107 | |
| 108 | with tempfile.TemporaryDirectory() as d: |
| 109 | with ChDir(d): |
| 110 | chain.check_file( |
| 111 | temp_py_file.name, solution_code=content |
| 112 | ).run().check_object("a").has_equal_value() |
| 113 | |
| 114 | with pytest.raises(TF): |
| 115 | with tempfile.TemporaryDirectory() as d: |
| 116 | with ChDir(d): |
| 117 | chain.check_file( |
| 118 | temp_py_file.name, solution_code=content.replace("1", "2") |
| 119 | ).run().has_equal_value(expr_code="a") |
| 120 | |
| 121 | with tempfile.TemporaryDirectory() as d: |
| 122 | with ChDir(d): |
| 123 | chain.check_file(temp_py_file.name).run().has_equal_value( |
| 124 | expr_code="a", override=1 |
| 125 | ) |
| 126 | |
| 127 | with pytest.raises(TF): |
| 128 | with tempfile.TemporaryDirectory() as d: |
| 129 | with ChDir(d): |
| 130 | chain.check_file(temp_py_file.name).run().has_equal_value( |
| 131 | expr_code="a", override=2 |
| 132 | ) |
| 133 | |
| 134 | |
| 135 | def test_running_file_with_root_check(temp_py_file): |
nothing calls this directly
no test coverage detected