|
9 | 9 | import subprocess
|
10 | 10 |
|
11 | 11 | from glob import glob
|
12 |
| -from os import getcwd, makedirs |
13 |
| -from os.path import abspath, basename, dirname, exists, join |
| 12 | +from os import environ, getcwd, makedirs |
| 13 | +from os.path import abspath, basename, dirname, exists, join, normpath |
14 | 14 | from shutil import copytree, copyfile, rmtree
|
15 | 15 |
|
16 | 16 | from nose.tools import eq_, assert_almost_equal
|
|
20 | 20 |
|
21 | 21 | _my_cwd = getcwd()
|
22 | 22 | _my_dir = abspath(dirname(__file__))
|
23 |
| -_examples_dir = join(_my_dir, '..', 'examples') |
| 23 | +_examples_dir = normpath(join(_my_dir, '..', 'examples')) |
24 | 24 |
|
25 | 25 | _old_titanic_dir = join(_examples_dir, 'titanic')
|
26 | 26 | _old_boston_dir = join(_examples_dir, 'boston')
|
|
30 | 30 | _new_boston_dir = join(_my_dir, 'other', 'boston')
|
31 | 31 | _new_iris_dir = join(_my_dir, 'other', 'iris')
|
32 | 32 |
|
| 33 | +# if we are running the tests without activating the conda |
| 34 | +# environment (as we do when testing the conda and TestPyPI |
| 35 | +# packages), then we will usually pass in a BINDIR environment |
| 36 | +# variable that points to where the environment's `bin` directory |
| 37 | +# is located |
| 38 | +_binary_dir = environ.get('BINDIR', '') |
| 39 | + |
33 | 40 |
|
34 | 41 | def run_configuration_and_check_outputs(config_path):
|
35 | 42 | """
|
@@ -90,11 +97,12 @@ def setup():
|
90 | 97 | copytree(_old_titanic_dir, _new_titanic_dir)
|
91 | 98 |
|
92 | 99 | # Create all of the data sets we need
|
93 |
| - subprocess.run(['python', join(_examples_dir, 'make_titanic_example_data.py')], |
| 100 | + python_binary = join(_binary_dir, 'python') if _binary_dir else 'python' |
| 101 | + subprocess.run([python_binary, join(_examples_dir, 'make_titanic_example_data.py')], |
94 | 102 | cwd=dirname(_new_titanic_dir))
|
95 |
| - subprocess.run(['python', join(_examples_dir, 'make_boston_example_data.py')], |
| 103 | + subprocess.run([python_binary, join(_examples_dir, 'make_boston_example_data.py')], |
96 | 104 | cwd=dirname(_new_boston_dir))
|
97 |
| - subprocess.run(['python', join(_examples_dir, 'make_iris_example_data.py')], |
| 105 | + subprocess.run([python_binary, join(_examples_dir, 'make_iris_example_data.py')], |
98 | 106 | cwd=dirname(_new_iris_dir))
|
99 | 107 |
|
100 | 108 | # Move all the configuration files to our new directories
|
|
0 commit comments