From 4fefa67dcfd7604e93bd4199d8c38a2771174afe Mon Sep 17 00:00:00 2001 From: mdp0023 Date: Mon, 29 Apr 2024 11:37:43 -0500 Subject: [PATCH] fix directory issues --- examples/svinsight_example_Travis_County.py | 15 ++++++++++++++- tests/test_svinsight.py | 12 ++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/examples/svinsight_example_Travis_County.py b/examples/svinsight_example_Travis_County.py index 0a34dac..e396711 100644 --- a/examples/svinsight_example_Travis_County.py +++ b/examples/svinsight_example_Travis_County.py @@ -1,6 +1,19 @@ import sys import os -sys.path.insert(0, '/Users/matthewpreisser/Documents/Research/Codes/SVInsight') +#sys.path.insert(0, '/Users/matthewpreisser/Documents/Research/Codes/SVInsight') + +# Get the directory that contains this file +this_directory = os.path.dirname(os.path.abspath(__file__)) + +# one level up +dir1 = os.path.dirname(this_directory) +# two levels up +dir2 = os.path.dirname(os.path.dirname(this_directory)) + +# Add the root directory to sys.path +sys.path.insert(0, this_directory) +sys.path.insert(0, dir1) +sys.path.insert(0, dir2) # import package diff --git a/tests/test_svinsight.py b/tests/test_svinsight.py index 2c96026..28f7478 100644 --- a/tests/test_svinsight.py +++ b/tests/test_svinsight.py @@ -5,14 +5,18 @@ # Get the directory that contains this file this_directory = os.path.dirname(os.path.abspath(__file__)) -# Get the root directory of your project (two levels up from this file) -root_directory = os.path.dirname(os.path.dirname(this_directory)) +# one level up +dir1 = os.path.dirname(this_directory) +# two levels up +dir2 = os.path.dirname(os.path.dirname(this_directory)) # Add the root directory to sys.path -sys.path.insert(0, root_directory) +sys.path.insert(0, this_directory) +sys.path.insert(0, dir1) +sys.path.insert(0, dir2) # import package -from SVInsight import SVInsight as svi +from svinsight import SVInsight as svi import os import pytest import geopandas as gpd