Skip to content

Commit

Permalink
pytest_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mdp0023 committed Nov 10, 2024
1 parent 3ed32af commit 156b4eb
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions tests/test_svinsight_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
sys.path.insert(0, dir1)
sys.path.insert(0, dir2)




##############################################################################################
# TESTS FOR MINOR PROJECT FUNCTIONALITY

Expand All @@ -35,7 +32,6 @@
geoids=['48453']
api_key = ''


def test_svi():
"""Test that project can be created"""
assert svi(f"{os.path.dirname(os.path.realpath(__file__))}/{project_name}", file_path, api_key, geoids)
Expand Down Expand Up @@ -67,12 +63,6 @@ def test_svi_geoids_correct():
for geo in geos:
assert svi(project_name, file_path, api_key, geo)







##############################################################################################
# TESTS FOR MAJOR PROJECT FUNCTIONALITY
# create a generic test architecture
Expand Down Expand Up @@ -126,7 +116,6 @@ def run_svi_workflow(project_name, file_path, geoids, config, boundary, year, ov
assert not svi_test[column].isna().all(), f"All values in column {column} are NaN"
assert not (svi_test[column] == 0).all(), f"All values in column {column} are 0"


# test figure plotting optinos
# PLOT OPTION 1
try:
Expand All @@ -149,14 +138,12 @@ def run_svi_workflow(project_name, file_path, geoids, config, boundary, year, ov
except Exception as e:
assert False, f"plot_svi, plot_option = 1, execution failed: {e}"


# remove all output files to reduce package space
os.remove(output_file3)
os.remove(output_file4)
os.remove(output_file5)
os.remove(output_file6)


# develop a test project for single county
boundaries = ['bg', 'tract']
years = [2015, 2020]
Expand All @@ -172,7 +159,6 @@ def test_single_county_project(boundary, year, overwrite=False):
year=year,
overwrite=overwrite)


# develop a test project for multiple counties
boundaries = ['bg', 'tract']
years = [2015, 2020]
Expand All @@ -187,7 +173,6 @@ def test_multiple_county_project(boundary, year, overwrite=False):
year=year,
overwrite=overwrite)


# develop a test project for multiple states
boundaries = ['bg', 'tract']
years = [2015]
Expand All @@ -202,6 +187,19 @@ def test_multiple_states_project(boundary, year, overwrite=False):
year=year,
overwrite=overwrite)

# develop a test project for single county, economic index
years = [2015]
@pytest.mark.parametrize("boundary, year", [(b, y) for b in boundaries for y in years])
def test_multiple_states_project(boundary, year, overwrite=False):
"""test creating and running a multiple states project for different years and boundaries"""
run_svi_workflow(project_name='test_project_multiple_states' ,
file_path=os.path.dirname(os.path.realpath(__file__)),
geoids=['25','44'],
config='config',
boundary=boundary,
year=year,
overwrite=overwrite)


# develop a test project for single county, economic index
boundaries = ['bg']
Expand Down

0 comments on commit 156b4eb

Please sign in to comment.