This repository has been archived by the owner on May 19, 2022. 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.
- Loading branch information
Showing
5 changed files
with
140 additions
and
0 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,5 @@ | ||
[run] | ||
source = scripts | ||
|
||
[report] | ||
include = scripts/* |
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 |
---|---|---|
|
@@ -51,3 +51,4 @@ excons.cache | |
/mGear.mod | ||
|
||
|
||
cover/ |
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,13 @@ | ||
language: python | ||
|
||
python: | ||
- 2.7 | ||
|
||
services: | ||
- docker | ||
|
||
install: | ||
- docker build -t mgear . | ||
|
||
script: | ||
- docker run -ti --rm -v $(pwd):/workspace mgear |
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,19 @@ | ||
FROM mottosso/maya:2016sp1 | ||
|
||
RUN wget https://bootstrap.pypa.io/get-pip.py && \ | ||
mayapy get-pip.py && \ | ||
mayapy -m pip install \ | ||
nose \ | ||
nose-exclude \ | ||
coverage \ | ||
sphinx \ | ||
six \ | ||
sphinxcontrib-napoleon \ | ||
python-coveralls | ||
|
||
# Avoid creation of auxilliary files | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
WORKDIR /workspace | ||
|
||
ENTRYPOINT mayapy -u run_tests.py |
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,102 @@ | ||
"""Use Mayapy for testing | ||
Usage: | ||
$ mayapy run_tests.py | ||
""" | ||
|
||
import os | ||
import sys | ||
import nose | ||
import logging | ||
import contextlib | ||
|
||
import six | ||
|
||
from maya import standalone | ||
from nose_exclude import NoseExclude | ||
|
||
|
||
def null(*args, **kwargs): | ||
pass | ||
|
||
|
||
@contextlib.contextmanager | ||
def mute(): | ||
try: | ||
sys.stdout = six.moves.StringIO() | ||
sys.stderr = six.moves.StringIO() | ||
yield | ||
|
||
finally: | ||
sys.stdout = sys.__stdout__ | ||
sys.stderr = sys.__stderr__ | ||
|
||
|
||
if __name__ == "__main__": | ||
# Expose mgear Python package to tests | ||
dirname = os.path.dirname(__file__) | ||
sys.path.insert(0, os.path.join(dirname, "scripts")) | ||
|
||
print("Initialising Maya..") | ||
with mute(): | ||
standalone.initialize() | ||
import pymel.core | ||
import pymel.internal.startup | ||
pymel.internal.startup.fixMayapy2011SegFault() | ||
|
||
for name, logger in logging.Logger.manager.loggerDict.items(): | ||
if "pymel" in name: | ||
logger.disabled = True | ||
|
||
argv = sys.argv[:] | ||
argv.extend([ | ||
|
||
# Sometimes, files from Windows accessed | ||
# from Linux cause the executable flag to be | ||
# set, and Nose has an aversion to these | ||
# per default. | ||
"--exe", | ||
|
||
# Produce nice, easily readable output from each test | ||
"--verbose", | ||
|
||
# Run through the docstring of every module | ||
# and run anything prefixed with ">>> " | ||
"--with-doctest", | ||
|
||
# Produce a coverage report post-tests | ||
"--with-coverage", | ||
"--cover-html", | ||
"--cover-tests", | ||
"--cover-erase", | ||
|
||
"--exclude-dir=cvwrap", | ||
"--exclude-dir=docs", | ||
"--exclude-dir=excons", | ||
"--exclude-dir=src", | ||
|
||
"tests", | ||
"scripts", | ||
]) | ||
|
||
# Visually separate output from the above Maya initialisation | ||
# and the actual tests. | ||
# TODO: Mute Maya output entirely; I don't know how it manages to still | ||
# output anything when sys.stdout and err are discarded.. | ||
print("\n" + "-" * 70) | ||
print("Running tests..\n") | ||
|
||
try: | ||
# Disable messages via PyMEL, they obfuscate the report | ||
pymel.core.displayWarning = null | ||
pymel.core.displayError = null | ||
|
||
nose.main(argv=argv, addplugins=[NoseExclude()]) | ||
|
||
finally: | ||
# Only bother when running when on Travis | ||
if os.getenv("TRAVIS_JOB_ID"): | ||
__import__("coveralls").wear() | ||
else: | ||
sys.stdout.write("Skipping coveralls\n") |