Skip to content

Commit 37d5aca

Browse files
committed
fixed unit test for run_plot_functions(), included this fun into the Sphinx documentation, and updated README with info about this fun
1 parent 736e172 commit 37d5aca

File tree

6 files changed

+23
-6
lines changed

6 files changed

+23
-6
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ The `sqlite_manager` package streamlines SQLite database workflows by offering t
2626
- Avoid redundant query execution unless explicitly requested, saving time and computational resources.
2727
- Log all execution details and errors for easy debugging and traceability.
2828

29+
3. Automated Plot Generation:
30+
- Generate plots from query results using Python plotting functions stored
31+
in directories.
32+
- Automatically detect and execute plotting functions based on predefined
33+
rules.
34+
- Save plots to specified directories, ensuring traceable and reproducible
35+
workflows.
36+
- Prevent redundant plot generation, and log all activities for clarity and
37+
debugging.
38+
2939
## Documentation
3040

3141
Check out the [webpage](https://thomas-rauter.github.io/sqlite_manager/) for the

docs/source/functions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Function Reference
33

44
.. autofunction:: sqlite_manager.create_sqlite_db
55
.. autofunction:: sqlite_manager.run_sql_queries
6+
.. autofunction:: sqlite_manager.run_plot_functions

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
setup(
1313
name="sqlite_manager",
1414
version="0.1.0",
15-
description="A package for managing SQLite operations",
15+
description="A package for managing SQLite workflows",
1616
long_description=long_description,
1717
long_description_content_type="text/markdown",
1818
author="Thomas Rauter",
1.47 KB
Binary file not shown.
610 Bytes
Binary file not shown.

tests/test_run_plot_functions.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ def setUp(self):
1515
self.query_results_dir = Path(self.temp_dir) / "query_results"
1616
self.plot_functions_dir = Path(self.temp_dir) / "plot_functions"
1717
self.output_dir = Path(self.temp_dir) / "output"
18-
self.log_file = Path(self.temp_dir) / "log.txt"
18+
self.log_dir = Path(self.temp_dir) / "logs"
1919

2020
self.query_results_dir.mkdir(parents=True, exist_ok=True)
2121
self.plot_functions_dir.mkdir(parents=True, exist_ok=True)
2222
self.output_dir.mkdir(parents=True, exist_ok=True)
23+
self.log_dir.mkdir(parents=True, exist_ok=True)
2324

2425
# Create a mock CSV file in the query_results directory
2526
csv_path = self.query_results_dir / "mock_data.csv"
@@ -57,16 +58,21 @@ def test_run_plot_functions(self):
5758
query_results_dir=self.query_results_dir,
5859
plot_functions_dir=self.plot_functions_dir,
5960
output_dir=self.output_dir,
60-
log_file=self.log_file,
61+
log_dir=self.log_dir, # Updated argument
6162
rerun_all=True
6263
)
6364
except Exception as e:
6465
self.fail(f"run_plot_functions raised an exception: {e}")
6566

66-
# Verify that the log file is created
67+
# Verify that the log directory contains the expected log file
68+
log_files = list(self.log_dir.glob("*.log"))
6769
self.assertTrue(
68-
self.log_file.exists(),
69-
"Log file was not created."
70+
len(log_files) > 0,
71+
"No log file was created in the log directory."
72+
)
73+
self.assertTrue(
74+
any("plot_functions_" in log_file.name for log_file in log_files),
75+
"Log file with the expected timestamped name was not created."
7076
)
7177

7278
# Verify that the output file is created

0 commit comments

Comments
 (0)