This repository has been archived by the owner on Oct 3, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split up test structure and add more unit tests
- Loading branch information
1 parent
4f78b3f
commit 974aaac
Showing
18 changed files
with
248 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
import subprocess | ||
|
||
from sniffer.api import select_runnable, file_validator, runnable | ||
from pync import Notifier | ||
|
||
|
||
watch_paths = ['yorm/', 'tests/'] | ||
|
||
|
||
@select_runnable('python_tests') | ||
@file_validator | ||
def py_files(filename): | ||
return all((filename.endswith('.py'), | ||
not os.path.basename(filename).startswith('.'))) | ||
|
||
|
||
@runnable | ||
def python_tests(*args): | ||
|
||
for count, (command, title) in enumerate(( | ||
(('make', 'test-unit'), "Unit Tests"), | ||
(('make', 'test-int'), "Integration Tests"), | ||
(('make', 'test-all'), "Combined Tests"), | ||
), start=1): | ||
|
||
failure = subprocess.call(command) | ||
|
||
if failure: | ||
mark = "❌" * count | ||
Notifier.notify(mark + " [FAIL] " + mark, title=title) | ||
return False | ||
else: | ||
mark = "✅" * count | ||
Notifier.notify(mark + " [PASS] " + mark, title=title) | ||
|
||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python | ||
|
||
"""Integration tests for the `yorm` package.""" | ||
|
||
import time | ||
import logging | ||
|
||
|
||
def strip(text, tabs=None, end='\n'): | ||
"""Strip leading whitespace indentation on multiline string literals.""" | ||
lines = text.strip().splitlines() | ||
for index in range(len(lines)): | ||
if not tabs: | ||
tabs = lines[index].count(' ' * 4) | ||
lines[index] = lines[index].replace(' ' * tabs * 4, '') | ||
return '\n'.join(lines) + end | ||
|
||
|
||
def refresh_file_modification_times(seconds=1.1): | ||
"""Sleep to allow file modification times to refresh.""" | ||
logging.info("delaying for %s second%s...", seconds, | ||
"" if seconds == 1 else "s") | ||
time.sleep(seconds) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.