Skip to content

Commit b30dd19

Browse files
committed
remove_main should not overwrite org file in local check run
1 parent b7656bf commit b30dd19

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/_remove_main.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@
44
def remove_main(test):
55
"""voorbewerking van het bestand voor testen"""
66

7-
with open(test.fileName, 'r') as f:
7+
global _originalFileName
8+
global _fileName
9+
10+
_originalFileName = _fileName
11+
12+
with open(_fileName, 'r') as f:
813
file_contents = f.readlines()
914

10-
with open(test.fileName, 'w') as f:
15+
tempfile = f"_{_fileName}.tmp"
16+
17+
with open(tempfile, 'w') as f:
1118
state = 0
1219
for line in file_contents:
1320
if state == 0:
@@ -23,3 +30,5 @@ def remove_main(test):
2330
if line.startswith('def '):
2431
f.write(line)
2532
state = 1
33+
34+
_fileName = tempfile

0 commit comments

Comments
 (0)