Commit Graph

2 Commits

Author SHA1 Message Date
Dhruv
0a42ae9095
Fix all errors mentioned in pre-commit run (#2512)
* Fix all errors mentioned in pre-commit run:

- Fix end of file
- Remove trailing whitespace
- Fix files with black
- Fix imports with isort

* Fix errors
2020-09-30 10:38:00 +02:00
Dhruv
ceacfc6079
Add algorithm for testing Project Euler solutions (#2471)
* 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>
2020-09-28 08:18:19 +02:00