-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #244 from henryiii/pytest
Py.test conversion
- Loading branch information
Showing
20 changed files
with
750 additions
and
711 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 |
---|---|---|
@@ -1,35 +1,12 @@ | ||
import pytest | ||
import os | ||
import sys | ||
import unittest | ||
from plumbum import local | ||
from plumbum.lib import IS_WIN32 | ||
|
||
def ensure_skipIf(unittest): | ||
""" | ||
This will ensure that unittest has skipIf. Call like:: | ||
skip_without_chown = pytest.mark.skipif(not hasattr(os, "chown"), | ||
reason="os.chown not supported") | ||
|
||
import unittest | ||
ensure_skipIf(unittest) | ||
""" | ||
skip_without_tty = pytest.mark.skipif(not sys.stdin.isatty(), | ||
reason="Not a TTY") | ||
|
||
if not hasattr(unittest, "skipIf"): | ||
import logging | ||
import functools | ||
def skipIf(condition, reason): | ||
def deco(func): | ||
if not condition: | ||
return func | ||
else: | ||
@functools.wraps(func) | ||
def wrapper(*args, **kwargs): | ||
logging.warn("skipping test: "+reason) | ||
return wrapper | ||
return deco | ||
unittest.skipIf = skipIf | ||
|
||
ensure_skipIf(unittest) | ||
skipIf = unittest.skipIf | ||
|
||
skip_on_windows = unittest.skipIf(IS_WIN32, "Does not work on Windows (yet)") | ||
skip_without_chown = unittest.skipIf(not hasattr(os, "chown"), "os.chown not supported") | ||
skip_without_tty = unittest.skipIf(not sys.stdin.isatty(), "Not a TTY") | ||
skip_on_windows = pytest.mark.skipif(sys.platform == "win32", | ||
reason="Windows not supported for this test (yet)") |
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 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 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.