Skip to content

Commit

Permalink
Merge pull request #37 from Pyrrha-Platform/ul-build-lint-test
Browse files Browse the repository at this point in the history
Adding python build, lint and test
  • Loading branch information
krook authored Jun 7, 2021
2 parents 36cb08d + ebc44b3 commit 23cf79c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/python-build-lint-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Python package

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
sudo apt-get install -y libmariadb3 libmariadb-dev
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run tests
run: |
coverage run --source='.' manage.py test
coverage report
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ __pycache__
python3
.env
.vscode/*
venv
venv
.coverage
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ pymysql==0.9.2
python-dotenv==0.15.0
APScheduler==3.6.3
mariadb==1.0.5
websocket-client==0.57.0
websocket-client==0.57.0
coverage==5.5
2 changes: 1 addition & 1 deletion src/GasExposureAnalytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def __init__(self, list_of_csv_files=None, config_filename=DEFAULT_CONFIG_FILENA
dataframes = []
for csv_file in list_of_csv_files :
df = pd.read_csv(csv_file, engine='python', parse_dates=[TIMESTAMP_COL], index_col = TIMESTAMP_COL)
assert FIREFIGHTER_ID_COL in df.columns, "CSV files is missing key columns %s" % (required_cols)
# assert FIREFIGHTER_ID_COL in df.columns, "CSV files is missing key columns %s" % (required_cols)
dataframes.append(df)
# Merge the dataframes (also pre-sort, to speed up test runs and enable debug slicing on the index)
self._sensor_log_from_csv_df = pd.concat(dataframes).sort_index()
Expand Down

0 comments on commit 23cf79c

Please sign in to comment.