[yt-svn] commit/yt: ngoldbaum: Merged in xarthisius/yt (pull request #1893)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Dec 17 13:20:31 PST 2015
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/97d5e68dd39a/
Changeset: 97d5e68dd39a
Branch: yt
User: ngoldbaum
Date: 2015-12-17 21:20:24+00:00
Summary: Merged in xarthisius/yt (pull request #1893)
[WIP] automatic answer testing definition
Affected #: 6 files
diff -r 47ce79f5d017d9a9352f30c0d1382b7297bbfd5c -r 97d5e68dd39a2a008c8c621f94d253bfa8fb0b5d tests/nose_runner.py
--- /dev/null
+++ b/tests/nose_runner.py
@@ -0,0 +1,54 @@
+import sys
+import os
+import yaml
+import multiprocessing as mp
+import nose
+import glob
+from contextlib import closing
+from yt.config import ytcfg
+from yt.utilities.answer_testing.framework import AnswerTesting
+
+
+def run_job(argv):
+ with closing(open(str(os.getpid()) + ".out", "w")) as fstderr:
+ cur_stderr = sys.stderr
+ sys.stderr = fstderr
+ answer = argv[0]
+ test_dir = ytcfg.get("yt", "test_data_dir")
+ answers_dir = os.path.join(test_dir, "answers")
+ if not os.path.isdir(os.path.join(answers_dir, answer)):
+ nose.run(argv=argv + ['--answer-store'],
+ addplugins=[AnswerTesting()], exit=False)
+ nose.run(argv=argv, addplugins=[AnswerTesting()], exit=False)
+ sys.stderr = cur_stderr
+
+if __name__ == "__main__":
+ test_dir = ytcfg.get("yt", "test_data_dir")
+ answers_dir = os.path.join(test_dir, "answers")
+ with open('tests/tests_%i.%i.yaml' % sys.version_info[:2], 'r') as obj:
+ tests = yaml.load(obj)
+
+ base_argv = ['--local-dir=%s' % answers_dir, '-v', '-s', '--nologcapture',
+ '--with-answer-testing', '--answer-big-data', '--local']
+ args = [['unittests', '-v', '-s', '--nologcapture']]
+ for answer in list(tests.keys()):
+ argv = [answer]
+ argv += base_argv
+ argv.append('--xunit-file=%s.xml' % answer)
+ argv.append('--answer-name=%s' % answer)
+ argv += tests[answer]
+ args.append(argv)
+
+ processes = [mp.Process(target=run_job, args=(args[i],))
+ for i in range(len(args))]
+ for p in processes:
+ p.start()
+ for p in processes:
+ p.join(timeout=7200)
+ if p.is_alive():
+ p.terminate()
+ p.join(timeout=30)
+ for fname in glob.glob("*.out"):
+ with open(fname, 'r') as fin:
+ print(fin.read())
+ os.remove(fname)
diff -r 47ce79f5d017d9a9352f30c0d1382b7297bbfd5c -r 97d5e68dd39a2a008c8c621f94d253bfa8fb0b5d tests/tests_2.7.yaml
--- /dev/null
+++ b/tests/tests_2.7.yaml
@@ -0,0 +1,51 @@
+local_artio_270:
+ - yt/frontends/artio/tests/test_outputs.py
+
+local_athena_270:
+ - yt/frontends/athena
+
+local_chombo_270:
+ - yt/frontends/chombo/tests/test_outputs.py
+
+local_enzo_270:
+ - yt/frontends/enzo
+
+local_fits_270:
+ - yt/frontends/fits/tests/test_outputs.py
+
+local_flash_270:
+ - yt/frontends/flash/tests/test_outputs.py
+
+local_gadget_270:
+ - yt/frontends/gadget/tests/test_outputs.py
+
+local_halos_270:
+ - yt/analysis_modules/halo_analysis/tests/test_halo_finders.py
+ - yt/analysis_modules/halo_finding/tests/test_rockstar.py
+ - yt/frontends/owls_subfind/tests/test_outputs.py
+
+local_owls_270:
+ - yt/frontends/owls/tests/test_outputs.py
+
+local_pw_270:
+ - yt/visualization/tests/test_plotwindow.py:test_attributes
+ - yt/visualization/tests/test_plotwindow.py:test_attributes_wt
+
+local_tipsy_270:
+ - yt/frontends/tipsy/tests/test_outputs.py
+
+local_varia_270:
+ - yt/analysis_modules/radmc3d_export
+ - yt/frontends/moab/tests/test_c5.py
+ - yt/analysis_modules/photon_simulator/tests/test_spectra.py
+ - yt/analysis_modules/photon_simulator/tests/test_sloshing.py
+ - yt/visualization/volume_rendering/tests/test_vr_orientation.py
+
+local_orion_270:
+ - yt/frontends/boxlib/tests/test_orion.py
+
+local_ramses_270:
+ - yt/frontends/ramses/tests/test_outputs.py
+
+local_ytdata_270:
+ - yt/frontends/ytdata
\ No newline at end of file
diff -r 47ce79f5d017d9a9352f30c0d1382b7297bbfd5c -r 97d5e68dd39a2a008c8c621f94d253bfa8fb0b5d tests/tests_3.4.yaml
--- /dev/null
+++ b/tests/tests_3.4.yaml
@@ -0,0 +1,49 @@
+local_artio_340:
+ - yt/frontends/artio/tests/test_outputs.py
+
+local_athena_340:
+ - yt/frontends/athena
+
+local_chombo_340:
+ - yt/frontends/chombo/tests/test_outputs.py
+
+local_enzo_340:
+ - yt/frontends/enzo
+
+local_fits_340:
+ - yt/frontends/fits/tests/test_outputs.py
+
+local_flash_340:
+ - yt/frontends/flash/tests/test_outputs.py
+
+local_gadget_340:
+ - yt/frontends/gadget/tests/test_outputs.py
+
+local_halos_340:
+ - yt/frontends/owls_subfind/tests/test_outputs.py
+
+local_owls_340:
+ - yt/frontends/owls/tests/test_outputs.py
+
+local_pw_340:
+ - yt/visualization/tests/test_plotwindow.py:test_attributes
+ - yt/visualization/tests/test_plotwindow.py:test_attributes_wt
+
+local_tipsy_340:
+ - yt/frontends/tipsy/tests/test_outputs.py
+
+local_varia_340:
+ - yt/analysis_modules/radmc3d_export
+ - yt/frontends/moab/tests/test_c5.py
+ - yt/analysis_modules/photon_simulator/tests/test_spectra.py
+ - yt/analysis_modules/photon_simulator/tests/test_sloshing.py
+ - yt/visualization/volume_rendering/tests/test_vr_orientation.py
+
+local_orion_340:
+ - yt/frontends/boxlib/tests/test_orion.py
+
+local_ramses_340:
+ - yt/frontends/ramses/tests/test_outputs.py
+
+local_ytdata_340:
+ - yt/frontends/ytdata
\ No newline at end of file
diff -r 47ce79f5d017d9a9352f30c0d1382b7297bbfd5c -r 97d5e68dd39a2a008c8c621f94d253bfa8fb0b5d yt/tests/test_flake8.py
--- a/yt/tests/test_flake8.py
+++ b/yt/tests/test_flake8.py
@@ -8,14 +8,15 @@
@requires_module('flake8')
def test_flake8():
yt_dir = os.path.dirname(os.path.abspath(yt.__file__))
- initial_dir = os.getcwd()
- os.chdir(yt_dir)
- output_file = os.path.sep.join([os.path.dirname(initial_dir), 'flake8.out'])
+ output_file = os.environ.get("WORKSPACE", None) or os.getcwd()
+ output_file = os.path.join(output_file, 'flake8.out')
if os.path.exists(output_file):
os.remove(output_file)
output_string = "--output-file=%s" % output_file
- subprocess.call(['flake8', output_string, os.curdir])
- os.chdir(initial_dir)
+ config_string = "--config=%s" % os.path.join(os.path.dirname(yt_dir),
+ 'setup.cfg')
+ subprocess.call(['flake8', output_string, config_string, yt_dir])
+
with open(output_file) as f:
flake8_output = f.readlines()
if flake8_output != []:
diff -r 47ce79f5d017d9a9352f30c0d1382b7297bbfd5c -r 97d5e68dd39a2a008c8c621f94d253bfa8fb0b5d yt/utilities/answer_testing/framework.py
--- a/yt/utilities/answer_testing/framework.py
+++ b/yt/utilities/answer_testing/framework.py
@@ -671,7 +671,11 @@
err_msg=err_msg, verbose=True)
def compare_image_lists(new_result, old_result, decimals):
- fns = ['old.png', 'new.png']
+ fns = []
+ for i in range(2):
+ tmpfd, tmpname = tempfile.mkstemp(suffix='.png')
+ os.close(tmpfd)
+ fns.append(tmpname)
num_images = len(old_result)
assert(num_images > 0)
for i in range(num_images):
diff -r 47ce79f5d017d9a9352f30c0d1382b7297bbfd5c -r 97d5e68dd39a2a008c8c621f94d253bfa8fb0b5d yt/visualization/tests/test_mesh_slices.py
--- a/yt/visualization/tests/test_mesh_slices.py
+++ b/yt/visualization/tests/test_mesh_slices.py
@@ -32,7 +32,7 @@
curdir = os.getcwd()
os.chdir(tmpdir)
- np.random.seed(0451)
+ np.random.seed(0x4d3d3d3)
# tetrahedral ds
ds = fake_tetrahedral_ds()
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list