Skip to content

Travis CI: Run black, doctest, flake8, mypy, and pytest #964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Jul 8, 2019
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
bc437e4
Travis CI: Add type checking with mypy
cclauss Jul 6, 2019
5dd8090
Create requirements.txt
cclauss Jul 6, 2019
d3d5a39
script: mypy --ignore-missing-stubs=cv2,numpy .
cclauss Jul 6, 2019
3f32aa8
Delete requirements.txt
cclauss Jul 6, 2019
ed1e00a
script: mypy --ignore-missing-imports .
cclauss Jul 6, 2019
6950950
Run doctests
cclauss Jul 6, 2019
d612c3a
Disable doctest -v other/detecting_english_programmatically.py
cclauss Jul 6, 2019
6846fcc
Pytest
cclauss Jul 6, 2019
9c7f9da
No |
cclauss Jul 6, 2019
d371f76
pytest || true
cclauss Jul 6, 2019
276b248
Run black doctest flake8 mypy pytest
cclauss Jul 6, 2019
5ca5b43
after_success: Build Directory.md
cclauss Jul 6, 2019
5ad53a7
Typo in filename: Dictionary.txt --> dictionary.txt'
cclauss Jul 6, 2019
047216f
python -m doctest -v
cclauss Jul 6, 2019
bd02765
pip install black flake8 mypy pytest
cclauss Jul 6, 2019
9994794
pytest --doctest-glob='*.py'
cclauss Jul 6, 2019
86bdb71
pytest --doctest-modules
cclauss Jul 6, 2019
19b45dd
pytest --doctest-modules ./sorts
cclauss Jul 6, 2019
5a1a398
pytest --doctest-modules ./ciphers ./other ./searches ./sorts ./strin…
cclauss Jul 6, 2019
a37327d
if __name__ == "__main__":
cclauss Jul 6, 2019
002287d
if __name__ == "__main__":
cclauss Jul 6, 2019
cec7e16
if __name__ == '__main__':
cclauss Jul 6, 2019
28d9e6d
if __name__ == '__main__':
cclauss Jul 6, 2019
1c27abc
if __name__ == '__main__':
cclauss Jul 6, 2019
704bf00
Create requirements.txt
cclauss Jul 6, 2019
3456316
Update requirements.txt
cclauss Jul 6, 2019
769f66d
if __name__ == "__main__":
cclauss Jul 6, 2019
122bf27
Lose the doctests
cclauss Jul 6, 2019
9ae08f3
if __name__ == '__main__':
cclauss Jul 6, 2019
03b4bdd
Remove print-a-tuple
cclauss Jul 6, 2019
8b55aff
doctest: Added missing spaces
cclauss Jul 6, 2019
33a8723
Update tabu_search.py
cclauss Jul 6, 2019
32349c1
The >>> are not doctests so change to >>)
cclauss Jul 6, 2019
5bc5634
Travis CI: Run black, doctest, flake8, mypy, and pytest
cclauss Jul 6, 2019
976f914
Link to the separate DIRECTORY.md file
cclauss Jul 7, 2019
364014b
Merge branch 'master' into mypy-on-Travis-CI
cclauss Jul 7, 2019
fab6bc2
Update README.md
poyea Jul 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
language: python
dist: xenial # required for Python >= 3.7
python: 3.7
install: pip install flake8
script: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
cache: pip
install: pip install black flake8 mypy pytest
before_script:
- black --check . || true
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why these lines are in before_script and why black has || true?

Copy link
Member Author

@cclauss cclauss Jul 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successful before_script results are hidden under twisties so they do not clutter the error log so contributors can go straight to the heart of the problems.

black will fail badly in the near term because we do not mandate formatted code. However, we want to be able to understand improvement as we make it without failing the build.

# - python -m doctest -v other/detecting_english_programmatically.py
- python -m doctest
ciphers/affine_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/transposition_cipher.py
other/frequency_finder.py
searches/binary_search.py
searches/linear_search.py
searches/sentinel_linear_search.py
sorts/bogo_sort.py
sorts/comb_sort.py
sorts/counting_sort.py
sorts/heap_sort.py
sorts/insertion_sort.py
sorts/merge_sort.py
sorts/quick_sort.py
sorts/selection_sort.py
sorts/shell_sort.py
strings/levenshtein_distance.py
script:
- mypy --ignore-missing-imports .
- pytest || true
after_success:
- python ./~script.py
- cat DIRECTORY.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well if we want to change the directory while merging, do we need a bot?

2 changes: 1 addition & 1 deletion other/detecting_english_programmatically.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def loadDictionary():
path = os.path.split(os.path.realpath(__file__))
englishWords = {}
with open(path[0] + '/Dictionary.txt') as dictionaryFile:
with open(path[0] + '/dictionary.txt') as dictionaryFile:
for word in dictionaryFile.read().split('\n'):
englishWords[word] = None
return englishWords
Expand Down