-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: extract common function for reuse
Signed-off-by: Mike Fiedler <miketheman@gmail.com>
- Loading branch information
1 parent
8f015e5
commit 25ea246
Showing
4 changed files
with
19 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
Common test functions. | ||
""" | ||
|
||
|
||
def assert_socket_blocked(result, passed=0, skipped=0, failed=1): | ||
""" | ||
Uses built in methods to test for common failure scenarios. | ||
Usually we only test for a single failure, | ||
but sometimes we want to test for multiple conditions, | ||
so we can pass in the expected counts. | ||
""" | ||
result.assert_outcomes(passed=passed, skipped=skipped, failed=failed) | ||
result.stdout.fnmatch_lines( | ||
"*Socket*Blocked*Error: A test tried to use socket.socket.*" | ||
) |
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