Python/.travis.yml
Dhruv 29b32d3553
Improve validate solutions script & fix pre-commit error (#3253)
* Trying to time every solution

* Proposal 2 for timing PE solutions:

- Use pytest fixture along with --capture=no flag to print out the
  top DURATIONS slowest solution at the end of the test sessions.
- Remove the print part and try ... except ... block from the test
  function.

* Proposal 3 for timing PE solutions:

Completely changed the way I was performing the tests. Instead of
parametrizing the problem numbers and expected output, I will
parametrize the solution file path.

Steps:
- Collect all the solution file paths
- Convert the paths into a Python module
- Call solution on the module
- Assert the answer with the expected results

For assertion, it was needed to convert the JSON list object to
Python dictionary object which required changing the JSON file itself.

* Add type hints for variables

* Fix whitespace in single_qubit_measure
2020-10-13 15:41:12 +05:30

26 lines
839 B
YAML

os: linux
dist: focal
language: python
python: 3.8
cache: pip
before_install: pip install --upgrade pip setuptools six
jobs:
include:
- name: Build
install: pip install pytest-cov -r requirements.txt
script:
- pytest --doctest-modules --ignore=project_euler/ --durations=10 --cov-report=term-missing:skip-covered --cov=. .
- name: Project Euler
install:
- pip install pytest-cov
script:
- pytest --doctest-modules --durations=10 --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
- name: Project Euler Solution
script:
- pytest --tb=short --durations=10 project_euler/validate_solutions.py
after_success:
- scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
notifications:
webhooks: https://www.travisbuddy.com/
on_success: never