def test(self): # Testing pandas has special requirements. # See: https://github.com/pandas-dev/pandas/issues/37939 # Obtain all the paths of the relevant test modules. This uses the # subprocess module to execute `conda run`, which then runs a single # Python command in the correct environment to import the test module # and print it's __file__ attribute. paths = [] for module_subpath in ( "util", "groupby.aggregate", "groupby.transform", "window", ): path = execute('conda run -n pandas python -c ' '"from pandas.tests.{} import test_numba ; ' 'print(test_numba.__file__)"'.format( module_subpath), capture=True) paths.append(path.decode("utf-8").strip()) # Run pytest on all the testing modules. This again uses subprocess to # execute conda run to run pytest in the correct environment on the # correct paths of the test module. execute('conda run --no-capture-output -n pandas pytest ' '{}'.format(" ".join(paths)))
def test_execute_false(self): with self.assertRaises(subprocess.CalledProcessError) as e: texasbbq.execute("false") self.assertIn( "Command '['false']' returned non-zero exit status 1.", str(e) )
def install(self): if not os.path.exists(self.name): git_clone_ref(self.clone_url, self.git_ref, self.name) os.chdir(self.name) execute("conda run -n {} {}".format(self.name, "python setup.py install")) os.chdir("awkward-numba") execute("conda run -n {} {}".format(self.name, "python setup.py install")) os.chdir('../../')
def test_execute_capture(self): result = texasbbq.execute("echo -n 'test'", capture=True) self.assertEqual(b"test", result)
def test_execute_true(self): # shoud be a no-op texasbbq.execute("true")
def install(self): """ Custom install function for TARDIS """ if not os.path.exists(self.name): self.clone() os.chdir(self.name) execute("conda run --no-capture-output -n {} {}".format(self.name, "pip install dokuwiki pytest-azurepipelines")) execute("conda run --no-capture-output -n {} {}".format(self.name, self.install_command)) execute("mkdir -p tardis-refdata/atom_data") #Download the necessary refdata execute("wget 'https://dev.azure.com/tardis-sn/TARDIS/_apis/git/repositories/tardis-refdata/items?path=atom_data/kurucz_cd23_chianti_H_He.h5&resolveLfs=true' -O tardis-refdata/atom_data/kurucz_cd23_chianti_H_He.h5") execute("wget 'https://dev.azure.com/tardis-sn/TARDIS/_apis/git/repositories/tardis-refdata/items?path=atom_data/chianti_He.h5&resolveLfs=true' -O tardis-refdata/atom_data/chianti_He.h5") execute("wget 'https://dev.azure.com/tardis-sn/TARDIS/_apis/git/repositories/tardis-refdata/items?path=unit_test_data.h5&resolveLfs=true' -O tardis-refdata/unit_test_data.h5") execute("wget 'https://dev.azure.com/tardis-sn/TARDIS/_apis/git/repositories/tardis-refdata/items?path=packet_unittest.h5&resolveLfs=true' -O tardis-refdata/packet_unittest.h5") execute("wget 'https://dev.azure.com/tardis-sn/TARDIS/_apis/git/repositories/tardis-refdata/items?path=montecarlo_1e5_compare_data.h5&resolveLfs=true' -O tardis-refdata/montecarlo_1e5_compare_data.h5") os.chdir('../')
def clone(self): # Awkward has special needs when cloning, --recursive. execute(f"git clone -b {self.git_ref} {self.clone_url} " f"--recursive {self.name}")