Skip to content

Commit

Permalink
Fix test logic
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxHalford committed Oct 9, 2024
1 parent 05a26f2 commit f0d273f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
5 changes: 1 addition & 4 deletions lea/clients/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,7 @@ def read_sql(self, query: str) -> pd.DataFrame:
return pandas_gbq.read_gbq(
query,
credentials=self.client._credentials,
project_id=self.compute_project_id,
# project_id: the project to execute the job in
# NB: there is no option to specify the write project, so we need to correctly specify
# the project in the query.
project_id=self.write_project_id,
location=self.location,
progress_bar_type=None,
)
Expand Down
20 changes: 12 additions & 8 deletions lea/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def run(
if job.error:
at_least_one_error = True
self.print(str(job.view), style="bold red")
self.print(job.error)
self.print(job.error, style="red")
if at_least_one_error:
return sys.exit(1)

Expand Down Expand Up @@ -500,19 +500,23 @@ def test(self, select_views: list[str], freeze_unselected: bool, threads: int, f
try:
conflicts = job.result()
except Exception as e:
print(f"Error in {test}")
print(e)
raise RuntimeError(f"Test {test} failed")
self.print(f"Error in {test}", style="bold red")
self.print(e, style="red")
at_least_one_error = True
if fail_fast and at_least_one_error:
for job in jobs:
job.cancel()
break
if conflicts.empty:
self.log(f"SUCCESS {test}", style="bold green")
else:
self.log(f"FAILURE {test}", style="bold red")
self.log(conflicts.head())
at_least_one_error = True
if fail_fast:
for job in jobs:
job.cancel()
break
if fail_fast and at_least_one_error:
for job in jobs:
job.cancel()
break

if at_least_one_error:
return sys.exit(1)
Expand Down

0 comments on commit f0d273f

Please sign in to comment.