mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
ceacfc6079
* Add file for testing Project Euler solutions * Remove the importlib import * Update project_euler/solution_test.py Co-authored-by: Christian Clauss <cclauss@me.com> * Small tweaks to project_euler/solution_test.py * Test Project Euler solutions through Travis * Improved testing for Project Euler solutions: - Renamed file so that it isn't picked up by pytest - Fail fast on validating solutions through Travis CI * Update validate_solutions.py * Use namedtuple for input parameters and answer - Remove logging - Remove unnecessary checks for PROJECT_EULER_PATH as Travis CI picks up the same path * Fix flake8 errors: line too long * Small tweaks to validate_solutions.py * Add all answers & back to using dictionary * Using pytest for testing Project Euler solutions - As we want to fail fast on testing solutions, we need to test using this script first before we use tests written by the author. - As pytest stops testing as soon as it receives a traceback, we need to use pytest-subtests to tell pytest to test all the iterations for the function with given parameters. * Print error messages in oneline format * Separated answers into a separate file: - Add custom print function to print all the error messages at the end of all the tests - Let Travis skip if this failed Co-authored-by: Christian Clauss <cclauss@me.com>
30 lines
1.2 KiB
YAML
30 lines
1.2 KiB
YAML
os: linux
|
|
dist: focal
|
|
language: python
|
|
python: 3.8
|
|
cache: pip
|
|
before_install: pip install --upgrade pip setuptools six
|
|
install: pip install black flake8
|
|
jobs:
|
|
include:
|
|
- name: Build
|
|
before_script:
|
|
- black --check . || true
|
|
- flake8 --ignore=E203,W503 --max-complexity=25 --max-line-length=88 --statistics --count .
|
|
- scripts/validate_filenames.py # no uppercase, no spaces, in a directory
|
|
- pip install -r requirements.txt # fast fail on black, flake8, validate_filenames
|
|
script:
|
|
- mypy --ignore-missing-imports . || true # https://github.com/python/mypy/issues/7907
|
|
- pytest --doctest-modules --ignore=project_euler/ --durations=10 --cov-report=term-missing:skip-covered --cov=. .
|
|
- name: Project Euler
|
|
before_script:
|
|
- pip install pytest-cov pytest-subtests
|
|
- pytest --tb=no --no-summary --capture=no project_euler/validate_solutions.py || true # fail fast on wrong solution
|
|
script:
|
|
- pytest --doctest-modules --durations=10 --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
|
|
after_success:
|
|
- scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
|
|
notifications:
|
|
webhooks: https://www.travisbuddy.com/
|
|
on_success: never
|