Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-38217: Add simple test and explicit pytest configuration #3

Merged
merged 3 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ pytest_session.txt
.cache/
.pytest_cache
.coverage

_build.*
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ exclude =
**/*/__init__.py,
**/*/version.py,
tests/.tests

[tool:pytest]
# pytest recommends this configuration.
addopts = --import-mode=importlib
33 changes: 33 additions & 0 deletions tests/test_load.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

import os.path
import unittest

from lsst.ctrl.execute import envString
from lsst.ctrl.execute.allocationConfig import AllocationConfig
from lsst.ctrl.execute.condorConfig import CondorConfig

TESTDIR = os.path.abspath(os.path.dirname(__file__))


class S3DFSimpleTestCase(unittest.TestCase):
"""Test basic configuration reading."""

def test_exec_config(self):
exec_config_name = os.path.join(TESTDIR, os.pardir, "etc", "config", "execConfig.py")

resolved_name = envString.resolve(exec_config_name)
configuration = CondorConfig()
configuration.load(resolved_name)
self.assertEqual(configuration.platform.scheduler, "slurm")

def test_allocation_config(self):
slurm_config_name = os.path.join(TESTDIR, os.pardir, "etc", "config", "slurmConfig.py")

resolved_name = envString.resolve(slurm_config_name)
configuration = AllocationConfig()
configuration.load(resolved_name)
self.assertEqual(configuration.platform.queue, "$QUEUE")


if __name__ == "__main__":
unittest.main()