Skip to content

Commit

Permalink
include tests (#4499)
Browse files Browse the repository at this point in the history
* include tests in sdist

* Adjust Slurm monkey-patches to accept new command caller API

---------

Co-authored-by: Adam Novak <[email protected]>
  • Loading branch information
mr-c and adamnovak authored Jun 15, 2023
1 parent 349cb7c commit fb58a9b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,9 @@ def run_setup():
install_requires=install_requires,
extras_require=extras_require,
package_dir={'': 'src'},
packages=find_packages(where='src',
# Note that we intentionally include the top-level `test` package for
# functionality like the @experimental and @integrative decorators:
exclude=['*.test.*']),
packages=find_packages(where='src'),
package_data={
'': ['*.yml', '*.yaml', 'cloud-config'],
'': ['*.yml', '*.yaml', 'cloud-config', '*.cwl'],
},
# Unfortunately, the names of the entry points are hard-coded elsewhere in the code base so
# you can't just change them here. Luckily, most of them are pretty unique strings, and thus
Expand Down
3 changes: 3 additions & 0 deletions src/toil/lib/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ def call_command(cmd: List[str], *args: str, input: Optional[str] = None, timeou
:returns: Command standard output, decoded as utf-8.
"""

# NOTE: Interface MUST be kept in sync with call_sacct and call_scontrol in
# test_slurm.py, which monkey-patch this!

# using non-C locales can cause GridEngine commands, maybe other to
# generate errors
if useCLocale:
Expand Down
6 changes: 4 additions & 2 deletions src/toil/test/batchSystems/test_slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
from toil.lib.misc import CalledProcessErrorStderr
from toil.test import ToilTest

# TODO: Come up with a better way to mock the commands then monkey-patching the
# command-calling functions.

def call_sacct(args) -> str:
def call_sacct(args, **_) -> str:
"""
The arguments passed to `call_command` when executing `sacct` are:
['sacct', '-n', '-j', '<comma-separated list of job-ids>', '--format',
Expand Down Expand Up @@ -41,7 +43,7 @@ def call_sacct(args) -> str:
return stdout


def call_scontrol(args) -> str:
def call_scontrol(args, **_) -> str:
"""
The arguments passed to `call_command` when executing `scontrol` are:
['scontrol', 'show', 'job'] or ['scontrol', 'show', 'job', '<job-id>']
Expand Down

0 comments on commit fb58a9b

Please sign in to comment.