Skip to content

Commit 05c8259

Browse files
authored
refactor: convert test cases to pytest (#194)
- Rename test file names to use underscores - Run nose2pytest against all test files - Run isort against all test files - Add __init__.py to tests directory - Add module docstrings - Remove imports from __future__ - Remove utf8 encoding declaration; not needed in Python3 - Get tests to pass
1 parent 6ca5605 commit 05c8259

22 files changed

+612
-608
lines changed

tests/__init__.py

Whitespace-only changes.

tests/common.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# -*- coding: utf-8 -*-
1+
"""Common utilities for test cases."""
2+
23
import subprocess
34

5+
46
def scontrol_show(subcommand, *args):
57
"""Return output of 'scontrol show <subcommand>'"""
68
if args:
@@ -9,12 +11,13 @@ def scontrol_show(subcommand, *args):
911
extra_args = ""
1012

1113
sctl = subprocess.Popen(
12-
["scontrol", "-d", "show", subcommand, extra_args],
13-
stdout=subprocess.PIPE
14+
["scontrol", "-d", "show", subcommand, extra_args], stdout=subprocess.PIPE
1415
).communicate()
1516

1617
sctl_stdout = sctl[0].strip().decode("UTF-8", "replace").split()
17-
sctl_dict = dict((value.split("=")[0], value.split("=")[1] if len(value.split("=")) > 1 else '')
18-
for value in sctl_stdout)
18+
sctl_dict = dict(
19+
(value.split("=")[0], value.split("=")[1] if len(value.split("=")) > 1 else "")
20+
for value in sctl_stdout
21+
)
1922

2023
return sctl_dict

tests/test-config.py

Lines changed: 0 additions & 101 deletions
This file was deleted.

tests/test-hostlist.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

tests/test-job.py

Lines changed: 0 additions & 113 deletions
This file was deleted.

tests/test-misc.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)