Pipeline PR workflow now runs code quality checks

This commit is contained in:
Carlos Felix 2024-12-05 15:34:10 -05:00 committed by Carlos Felix
commit 95246c9df0
6 changed files with 51 additions and 76 deletions

View file

@ -132,7 +132,9 @@ def tile_data_expected():
@pytest.fixture()
def create_tile_score_data_input():
return pd.read_pickle(pytest.SNAPSHOT_DIR / "create_tile_score_data_input.pkl")
return pd.read_pickle(
pytest.SNAPSHOT_DIR / "create_tile_score_data_input.pkl"
)
@pytest.fixture()

View file

@ -83,7 +83,9 @@ def test_create_score_data(
)
def test_create_tile_data(etl, create_tile_score_data_input, create_tile_data_expected):
def test_create_tile_data(
etl, create_tile_score_data_input, create_tile_data_expected
):
output_tiles_df_actual = etl._create_tile_data(create_tile_score_data_input)
pdt.assert_frame_equal(
output_tiles_df_actual,
@ -158,8 +160,10 @@ def test_load_downloadable_zip(etl, monkeypatch, score_data_expected):
def test_create_tract_search_data(census_geojson_sample_data: gpd.GeoDataFrame):
# Sanity check
assert len(census_geojson_sample_data) > 0
result = PostScoreETL()._create_tract_search_data(census_geojson_sample_data)
result = PostScoreETL()._create_tract_search_data(
census_geojson_sample_data
)
assert isinstance(result, pd.DataFrame)
assert not result.columns.empty
columns = ["GEOID10", "INTPTLAT10", "INTPTLON10"]

View file

@ -1,27 +0,0 @@
[tox]
# required because we use pyproject.toml
isolated_build = true
envlist = py310, lint, checkdeps, pytest
# only checks python versions installed locally
skip_missing_interpreters = true
[testenv:lint]
deps = pytest
# lints python code in src and tests
commands = black data_pipeline
flake8 data_pipeline
pylint data_pipeline
[testenv:checkdeps]
# checks the dependencies for security vulnerabilities and open source licenses
allowlist_externals = bash
commands = pip install -U wheel
# known issue: https://github.com/pyupio/safety/issues/364
# jinja2 false positive for our use: https://data.safetycli.com/v/70612/f17
safety check --ignore 51457 --ignore 44715 --ignore 70612
bash scripts/run-liccheck.sh
[testenv:pytest]
# Run tests
deps = pytest
commands = pytest --full-trace