-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Lets trigger tests * Yucky dependency installation * Skip flakey for setup * Lint * Coverage * Small whoopsie in cov call * Change trigger for code cov * Fix cov * Start testing, write test plan * Split up tests config and announcing * Fix linting and tests * Change pytest * Adjust cov file * Revert unknown option * Swap lint, fix some * Small changes * Fix folder name * Fix cov * Try fix * Remove some * Clean up * Clean more * Verbose * Fix * Test * Fix tests * Yuck * Test further with mocks * Fix test, improve coverage slightly * Add config key assertions * Flakey * More coverage of config functionality * Added octofarm version check test with mock * Add update state check * Cover more on config * Mock settings * Validation test * Avoid writing files during test, keep cov * Access_token and Announce flow * Finalize tests * Cleanup a bit * Adjust changelog * Comment
- Loading branch information
David Zwart
authored
Jun 23, 2021
1 parent
c83f4b7
commit 6f3772a
Showing
13 changed files
with
706 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run] | ||
omit = tests/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Python package | ||
|
||
on: [ pull_request ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ 3.7, 3.8 ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest pytest-cov flask octoprint requests | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Test with pytest and pytest-cov | ||
run: | | ||
pytest --cache-clear --verbose --cov=octofarm_companion | ||
- name: Build coverage file | ||
run: | | ||
pytest --cache-clear --cov=octofarm_companion tests/ > pytest-coverage.txt | ||
- 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: Comment coverage | ||
uses: coroo/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class Errors: | ||
access_token_too_short = "The 'access_token' did not meet the expected length of 43 characters. Preventing " | ||
"announcement query to OctoFarm" | ||
access_token_not_saved = "Conditional error: 'access_token' was not saved properly. Please report a bug to the " \ | ||
"plugin developers. Aborting " | ||
base_url_not_provided = "The 'base_url' was not provided. Preventing announcement query to OctoFarm" | ||
openid_config_unset = "Error connecting to OctoFarm. 'oidc_client_id' or 'oidc_client_secret' not set" | ||
config_openid_missing = "Configuration error: 'oidc_client_id' or 'oidc_client_secret' not set" | ||
ping_setting_unset = "'ping' config value not set. Aborting" | ||
|
||
class Keys: | ||
persistence_uuid_key = "persistence_uuid" | ||
device_uuid_key = "device_uuid" | ||
|
||
|
||
class Config: | ||
access_token_length = 43 | ||
uuid_length = 36 | ||
persisted_data_file = "backup_excluded_data.json" | ||
default_octofarm_host = "http://127.0.0.1" | ||
default_octoprint_host = "http://127.0.0.1" | ||
default_octofarm_port = 4000 | ||
default_ping_secs = 120 | ||
|
||
|
||
class State: | ||
BOOT = "boot" | ||
SUCCESS = "success" | ||
SLEEP = "sleep" | ||
CRASHED = "crashed" | ||
RETRY = "retry" |
Oops, something went wrong.