Skip to content

Commit 29b32d3

Browse files
authored
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
1 parent 6e01004 commit 29b32d3

File tree

4 files changed

+769
-2944
lines changed

4 files changed

+769
-2944
lines changed

Diff for: .travis.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ jobs:
1616
script:
1717
- pytest --doctest-modules --durations=10 --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
1818
- name: Project Euler Solution
19-
install:
20-
- pip install pytest-subtests
2119
script:
22-
- pytest --tb=short project_euler/validate_solutions.py
20+
- pytest --tb=short --durations=10 project_euler/validate_solutions.py
2321
after_success:
2422
- scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
2523
notifications:

0 commit comments

Comments
 (0)