-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfix_tests.py
More file actions
37 lines (31 loc) · 1.1 KB
/
fix_tests.py
File metadata and controls
37 lines (31 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import glob
import re
for path in glob.glob("tests/*.py"):
with open(path) as f:
content = f.read()
# 1. Replace monkeypatch.setattr(pipeline_mod.pozos_module, "get_pozo_resultadosloto", X)
content = re.sub(
r'monkeypatch\.setattr\(\s*pipeline_mod\.pozos_module,\s*"get_pozo_resultadosloto",\s*(.*?)\s*\)',
r'pipeline_mod.POZO_SOURCES = (("res", \1),) + pipeline_mod.POZO_SOURCES',
content,
)
# Also patch openloto:
content = re.sub(
r'monkeypatch\.setattr\(\s*pipeline_mod\.pozos_module,\s*"get_pozo_openloto",\s*(.*?)\s*\)',
r'pipeline_mod.POZO_SOURCES = pipeline_mod.POZO_SOURCES + (("open", \1),)',
content,
)
# 2. Main tests
content = re.sub(
r'monkeypatch\.setattr\(main_mod,\s*"get_pozo_resultadosloto",\s*(.*?)\s*\)',
r"# Deprecated: \1",
content,
)
# 3. phase4 tests
content = re.sub(
r'monkeypatch\.setattr\("polla_app\.__main__\.get_pozo_resultadosloto",\s*(.*?)\s*\)',
r"# Deprecated: \1",
content,
)
with open(path, "w") as f:
f.write(content)