Skip to content

Commit

Permalink
Simplify import of parent directory with the use of PYTHONPATH=../.. …
Browse files Browse the repository at this point in the history
…since emission is two directory above the current test_*.py files directory. Used importlib as the parent directory has - in saved-notebooks.
  • Loading branch information
iantei committed Nov 5, 2024
1 parent 63867f4 commit bba61b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion viz_scripts/docker/start_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ conda env list
cd saved-notebooks/tests || exit 1

echo "Starting unit tests..."
PYTHONPATH=. coverage run -m pytest test_plots.py
PYTHONPATH=../.. coverage run -m pytest test_plots.py -v

coverage report
8 changes: 3 additions & 5 deletions viz_scripts/tests/test_plots.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import pytest as pytest
import pandas as pd
import numpy as np
import os
import pathlib
import sys
sys.path.append(str(pathlib.Path(__file__).parent.parent))
import plots as plots
# Using import_module, as we have saved-notebooks as the directory
import importlib
plots = importlib.import_module('saved-notebooks.plots')

# Test Data Fixtures
@pytest.fixture
Expand Down

0 comments on commit bba61b6

Please sign in to comment.