Skip to content

Commit 239f031

Browse files
authored
Use sqlalchemy version (#68)
* add more lines from const * use fixture * use autouse in conftest * run generate * use ha sqlalchemy version * add newline
1 parent 81c8b5d commit 239f031

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

generate_phacc/generate_phacc.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
with open(REQUIREMENTS_FILE, "r") as original_file:
7777
data = original_file.readlines()
78-
78+
7979
new_data = []
8080
removed_data = []
8181
for d in data:
@@ -87,6 +87,22 @@
8787
removed_data.append(d)
8888
new_data.append(f"homeassistant=={ha_version}\n")
8989
new_data.insert(0, added_text)
90+
91+
92+
def find_sqlalchemy(data):
93+
for d in data:
94+
if "sqlalchemy" in d:
95+
return d
96+
raise ValueError("could not find sqlalchemy")
97+
98+
99+
with open(os.path.join(TMP_DIR, "requirements_all.txt"), "r") as f:
100+
data = f.readlines()
101+
sqlalchemy = find_sqlalchemy(data)
102+
if not "\n" == sqlalchemy[-2:]:
103+
sqlalchemy = f"{sqlalchemy}\n"
104+
new_data.append(sqlalchemy)
105+
90106
removed_data.insert(0, added_text)
91107

92108
with open(REQUIREMENTS_FILE, "w") as new_file:

requirements_test.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ respx==0.17.0
2323
stdlib-list==0.7.0
2424
tqdm==4.49.0
2525
homeassistant==2021.6.0b0
26+
sqlalchemy==1.4.13
27+

0 commit comments

Comments
 (0)