yt.utilities.answer_testing.testing_utilities module

yt.utilities.answer_testing.testing_utilities.can_run_ds(ds_fn, file_check=False)[source]

Validates whether or not a given input can be loaded and used as a Dataset object.

yt.utilities.answer_testing.testing_utilities.can_run_sim(sim_fn, sim_type, file_check=False)[source]

Validates whether or not a given input can be used as a simulation time-series object.

yt.utilities.answer_testing.testing_utilities.data_dir_load(ds_fn, cls=None, args=None, kwargs=None)[source]

Loads a sample dataset from the designated test_data_dir for use in testing.

yt.utilities.answer_testing.testing_utilities.generate_hash(data)[source]

Actually performs the hash operation.

Parameters:

data (python object) – Data to be hashed.

Returns:

hd – Hex digest of the hashed data.

Return type:

str

yt.utilities.answer_testing.testing_utilities.get_parameterization(fname)[source]

Returns a dataset’s field list to make test parameterizationn easier.

Some tests (such as those that use the toro1d dataset in enzo) check every field in a dataset. In order to parametrize the tests without having to hardcode a list of every field, this function is used. Additionally, if the dataset cannot be found, this function enables pytest to mark the test as failed without the whole test run crashing, since the parameterization happens at import time.

yt.utilities.answer_testing.testing_utilities.requires_ds(ds_fn, file_check=False)[source]

Meta-wrapper for specifying required data for a test and checking if said data exists.

yt.utilities.answer_testing.testing_utilities.requires_sim(sim_fn, sim_type, file_check=False)[source]

Meta-wrapper for specifying a required simulation for a test and checking if said simulation exists.