Answer principles round 2: 0 🔴, 2 🟡 (0 misread); workflow-bench hands its effects in as arguments, and no Python file of the repo patches a global
CI / tests (pull_request) Successful in 3m46s
CI / tests (pull_request) Successful in 3m46s
This commit is contained in:
@@ -20,10 +20,11 @@ def patches(source: str) -> list[int]:
|
||||
|
||||
|
||||
class NoPatchedGlobals(unittest.TestCase):
|
||||
def test_no_python_file_under_bin_patches_a_global(self):
|
||||
def test_no_python_file_patches_a_global(self):
|
||||
# A file not yet staged counts too, so a new suite is checked before its first commit.
|
||||
listed = subprocess.run(["git", "ls-files", "--cached", "--others", "--exclude-standard", "bin/*.py"],capture_output=True, check=True, cwd=ROOT, text=True).stdout.split()
|
||||
listed = subprocess.run(["git", "ls-files", "--cached", "--others", "--exclude-standard", "*.py"], capture_output=True, check=True, cwd=ROOT, text=True).stdout.split()
|
||||
self.assertIn("bin/repo_checks/test_no_patched_globals.py", listed)
|
||||
self.assertIn("workflow-bench/test_bench.py", listed)
|
||||
patching = {name for name in listed if patches((ROOT / name).read_text(encoding="utf-8"))}
|
||||
self.assertEqual(patching, set(), "hand the code under test its effect as an argument instead")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user