From 1d7104a96bc30651be2c5978c53926fb6529ff23 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 19 Jun 2015 11:53:26 -0400 Subject: [PATCH] Fix race condition when Python 2 and Python 3 tests run in parallel --- interfaces/cython/cantera/test/test_onedim.py | 6 +++--- interfaces/cython/cantera/test/utilities.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/interfaces/cython/cantera/test/test_onedim.py b/interfaces/cython/cantera/test/test_onedim.py index 110ed013e2..9a89f6a3bd 100644 --- a/interfaces/cython/cantera/test/test_onedim.py +++ b/interfaces/cython/cantera/test/test_onedim.py @@ -241,7 +241,7 @@ def test_save_restore(self): self.create_sim(p, Tin, reactants) self.solve_fixed_T() - filename = 'onedim-fixed-T.xml' + filename = 'onedim-fixed-T{0}.xml'.format(utilities.python_version) if os.path.exists(filename): os.remove(filename) @@ -302,7 +302,7 @@ def test_save_restore_add_species(self): p = 2 * ct.one_atm Tin = 400 - filename = 'onedim-add-species.xml' + filename = 'onedim-add-species{0}.xml'.format(utilities.python_version) if os.path.exists(filename): os.remove(filename) @@ -330,7 +330,7 @@ def test_save_restore_remove_species(self): p = 2 * ct.one_atm Tin = 400 - filename = 'onedim-add-species.xml' + filename = 'onedim-add-species{0}.xml'.format(utilities.python_version) if os.path.exists(filename): os.remove(filename) diff --git a/interfaces/cython/cantera/test/utilities.py b/interfaces/cython/cantera/test/utilities.py index cb705ba5e4..8a53ff6a7a 100644 --- a/interfaces/cython/cantera/test/utilities.py +++ b/interfaces/cython/cantera/test/utilities.py @@ -4,6 +4,8 @@ import warnings _ver = sys.version_info[:2] +python_version = str(_ver[0]) + if _ver < (2,7) or (3,0) <= _ver < (3,2): # unittest2 is a backport of the new features added to the unittest # testing framework in Python 2.7 and Python 3.2. See