Fix For Travis Test Step (#20)
Replaces test command in .travis.yml so tests get run. Updates Flake8 configuration. Adds Tox to handle testing of multiple Python versions. Adds test dependencies to setup.py. Fixes bug in test.
This commit is contained in:
parent
99641c5052
commit
3a2b6f4acf
|
@ -12,6 +12,8 @@ before_install:
|
|||
- sudo apt-get install -qq cmake python-numpy python-scipy libboost-python-dev
|
||||
- pip install git+https://github.com/ageitgey/face_recognition_models
|
||||
|
||||
install: pip install -r requirements.txt
|
||||
install:
|
||||
- pip install -r requirements.txt
|
||||
- pip install tox-travis
|
||||
|
||||
script: python -m tests.test_face_recognition
|
||||
script: tox
|
||||
|
|
|
@ -7,6 +7,7 @@ import scipy.misc
|
|||
import warnings
|
||||
import face_recognition.api as face_recognition
|
||||
|
||||
|
||||
def scan_known_people(known_people_folder):
|
||||
known_names = []
|
||||
known_face_encodings = []
|
||||
|
@ -52,6 +53,7 @@ def test_image(image_to_check, known_names, known_face_encodings):
|
|||
def image_files_in_folder(folder):
|
||||
return [os.path.join(folder, f) for f in os.listdir(folder) if re.match(r'.*\.(jpg|jpeg|png)', f, flags=re.I)]
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.argument('known_people_folder')
|
||||
@click.argument('image_to_check')
|
||||
|
@ -63,5 +65,6 @@ def main(known_people_folder, image_to_check):
|
|||
else:
|
||||
test_image(image_to_check, known_names, known_face_encodings)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
14
setup.cfg
14
setup.cfg
|
@ -15,5 +15,17 @@ replace = __version__ = '{new_version}'
|
|||
universal = 1
|
||||
|
||||
[flake8]
|
||||
exclude = docs
|
||||
exclude =
|
||||
.github,
|
||||
.idea,
|
||||
.eggs,
|
||||
examples,
|
||||
docs,
|
||||
.tox,
|
||||
bin,
|
||||
dist,
|
||||
tools,
|
||||
*.egg-info,
|
||||
__init__.py,
|
||||
*.yml
|
||||
max-line-length = 160
|
||||
|
|
3
setup.py
3
setup.py
|
@ -19,7 +19,8 @@ requirements = [
|
|||
]
|
||||
|
||||
test_requirements = [
|
||||
# TODO: put package test requirements here
|
||||
'tox',
|
||||
'flake8'
|
||||
]
|
||||
|
||||
setup(
|
||||
|
|
|
@ -112,9 +112,9 @@ class Test_face_recognition(unittest.TestCase):
|
|||
face_encoding_b1]
|
||||
|
||||
match_results = api.compare_faces(faces_to_compare, face_encoding_a1)
|
||||
self.assertIs(match_results[0], True)
|
||||
self.assertIs(match_results[1], True)
|
||||
self.assertIs(match_results[2], False)
|
||||
self.assertTrue(match_results[0])
|
||||
self.assertTrue(match_results[1])
|
||||
self.assertFalse(match_results[2])
|
||||
|
||||
def test_command_line_interface(self):
|
||||
target_string = '--help Show this message and exit.'
|
||||
|
|
Loading…
Reference in New Issue