diff --git a/lapis/pool_io/htcondor.py b/lapis/pool_io/htcondor.py index 81432a2..4b298d9 100644 --- a/lapis/pool_io/htcondor.py +++ b/lapis/pool_io/htcondor.py @@ -17,7 +17,7 @@ def htcondor_pool_reader(iterable, resource_name_mapping: dict={ :param resource_name_mapping: Mapping from given header names to well-defined resources in simulation :param pool_type: The type of pool to be yielded :param make_drone: - :return: Yields the :py:class:`StaticPool`s found in the given iterable + :return: Yields the :py:class:`Pool`s found in the given iterable """ assert make_drone reader = csv.DictReader(iterable, delimiter=' ', skipinitialspace=True) diff --git a/lapis_tests/data/htcondor_pools.csv b/lapis_tests/data/htcondor_pools.csv new file mode 100644 index 0000000..82ffa21 --- /dev/null +++ b/lapis_tests/data/htcondor_pools.csv @@ -0,0 +1,5 @@ + Count TotalSlotCPUs TotalSlotDisk TotalSlotMemory + 2 2 224400.0 8000 + 2 2 223100.0 8000 + 1 8 196300.0 32200 + 1 4 29700.0 8000 \ No newline at end of file diff --git a/lapis_tests/pool_io/__init__.py b/lapis_tests/pool_io/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lapis_tests/pool_io/test_htcondor.py b/lapis_tests/pool_io/test_htcondor.py new file mode 100644 index 0000000..02835ee --- /dev/null +++ b/lapis_tests/pool_io/test_htcondor.py @@ -0,0 +1,24 @@ +import os + +import pytest + +from lapis.pool_io.htcondor import htcondor_pool_reader + + +def data_path(): + return os.path.join(os.path.dirname(__file__), "..", "data", "htcondor_pools.csv") + + +class TestHtcondorPoolReader(object): + def test_init(self): + with open(data_path()) as input_file: + with pytest.raises(AssertionError): + next(htcondor_pool_reader(input_file)) + + def test_simple(self): + with open(data_path()) as input_file: + pools = 0 + for pool in htcondor_pool_reader(input_file, make_drone=lambda: None): + assert pool is not None + pools += 1 + assert pools > 0 diff --git a/lapis_tests/test_job.py b/lapis_tests/test_job.py new file mode 100644 index 0000000..a985a5b --- /dev/null +++ b/lapis_tests/test_job.py @@ -0,0 +1,17 @@ +import pytest + +from lapis.job import Job + + +class TestJob(object): + def test_init(self): + with pytest.raises(AssertionError): + Job({}, {}) + assert Job({}, {"walltime": 100}) + + def test_name(self): + name = "test" + job = Job({}, {"walltime": 100}, name=name) + assert job.name == name + job = Job({}, {"walltime": 100}) + assert job.name == id(job)