Skip to content

Commit 315cd0e

Browse files
committed
Reportlab made optional & updated log parsing
1 parent b28d602 commit 315cd0e

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

carbontracker/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def generate_report(log_file, output_pdf):
1616
# Check for reportlab dependency early
1717
if not REPORTLAB_AVAILABLE:
1818
print("Error: The 'reportlab' package is required to generate PDF reports but is not installed.")
19-
print("Please install it with: pip install carbontracker[pdfreport]")
19+
print("Please install it with: pip install 'carbontracker[pdfreport]'")
2020
return
2121

2222
if not os.path.exists(log_file):

carbontracker/report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def generate_report_from_log(log_file_path, output_path):
226226
if not REPORTLAB_AVAILABLE:
227227
raise ImportError(
228228
"The 'reportlab' package is required to generate PDF reports but is not installed. "
229-
"Please install it with: pip install carbontracker[pdfreport]"
229+
"Please install it with: pip install 'carbontracker[pdfreport]'"
230230
)
231231

232232
# Read and parse log

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_generate_report_shows_error_without_reportlab(self):
8787
output = captured_output.getvalue()
8888

8989
# Check the error message contains installation instructions
90-
self.assertIn("pip install carbontracker[pdfreport]", output)
90+
self.assertIn("pip install 'carbontracker[pdfreport]'", output)
9191
self.assertIn("reportlab", output)
9292
finally:
9393
# Restore original values

tests/test_report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def test_generate_report_raises_import_error_without_reportlab(self):
279279
generate_report_from_log("dummy_log.txt", "dummy_output.pdf")
280280

281281
# Check the error message contains installation instructions
282-
self.assertIn("pip install carbontracker[pdfreport]", str(context.exception))
282+
self.assertIn("pip install 'carbontracker[pdfreport]'", str(context.exception))
283283
self.assertIn("reportlab", str(context.exception))
284284
finally:
285285
# Restore original value

0 commit comments

Comments
 (0)