Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run_nose(self):
nose.run(argv=shlex.split(self.args))
# requests module logging
requests_logger = logging.getLogger("requests")
requests_logger.addHandler(handler)
requests_logger.setLevel(logging.WARN)
# tiledVolume logging
tiledVolumeLogger = logging.getLogger("lazyflow.utility.io_util.tiledVolume")
tiledVolumeLogger.addHandler(handler)
tiledVolumeLogger.setLevel(logging.ERROR)
import sys
import nose
sys.argv.append("--nocapture") # Don't steal stdout. Show it on the console as usual.
sys.argv.append("--nologcapture") # Don't set the logging level to DEBUG. Leave it alone.
ret = nose.run(defaultTest=__file__)
if not ret:
sys.exit(1)
assert ufmfReader.Output.meta.dtype == EXPECTED_DTYPE
assert ufmfReader.Output.meta.axistags == vigra.defaultAxistags(EXPECTED_AXIS_ORDER)
# There was a bug that accidentally caused the same frame to be duplicated
# across all output frames if you requested more than one frame in a single request.
# Here, we at least verify that the first frame and the last frame are not identical.
assert not (output[0] == output[99]).all()
# Clean reader
ufmfReader.cleanUp()
if __name__ == "__main__":
import nose
ret = nose.run(defaultTest=__file__, env={"NOSE_NOCAPTURE": 1})
if not ret:
sys.exit(1)
Returns
-------
bool
True, if all the missing answers are successfully generated
False, otherwise
"""
status = True
test_argv = [os.path.basename(__file__), '--with-answer-testing',
'--nologcapture', '-s', '-d', '-v', '--local',
'--local-dir=%s' % answer_dir, '--answer-store']
for job in missing_answers:
log.info(" Generating answers for " + job)
status &= nose.run(argv=test_argv+[job], addplugins=[AnswerTesting()],
exit=False)
return status
import nose
nose.run()
expected_data = self.original_data[slicing]
if transposed_operator:
expected_data = expected_data.transpose()
# Compare.
assert (subvol.view(numpy.ndarray) == expected_data).all(), "Data from server didn't match expected data!"
if __name__ == "__main__":
import sys
import nose
sys.argv.append("--nocapture") # Don't steal stdout. Show it on the console as usual.
sys.argv.append("--nologcapture") # Don't set the logging level to DEBUG. Leave it alone.
nose.run(defaultTest=__file__)
for fmt in ('jpg', 'png', 'pnm', 'bmp'):
opExport.OutputFormat.setValue(fmt)
msg = opExport.FormatSelectionErrorMsg.value
assert msg, "{} supported although it is actually not".format(fmt)
if __name__ == "__main__":
import sys
import nose
import logging
handler = logging.StreamHandler( sys.stdout )
logging.getLogger().addHandler( handler )
sys.argv.append("--nocapture") # Don't steal stdout. Show it on the console as usual.
sys.argv.append("--nologcapture") # Don't set the logging level to DEBUG. Leave it alone.
nose.run(defaultTest=__file__)
def runmodels():
print " -- running model tests"
testdir = os.path.normpath('./tests/models/')
configfile = os.path.join(os.path.normpath('./config/'), "nose.cfg")
argv = [configfile, testdir]
nose.run(argv=argv)
return
def run_test():
import nose
nose.run(module='tests')
def run_nose(cover_pkg, test_file, dry_run=False):
cover_arg = '--cover-package=%s' % cover_pkg
sys.argv += ['-sv', '--with-coverage', cover_arg]
# Print out command for user feedback and debugging
cmd = 'nosetests -sv --with-coverage %s %s' % (cover_arg, test_file)
print cmd
if dry_run:
return cmd
else:
print
nose.run()