Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion reframe/core/schedulers/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ def emit_preamble(self):
else:
preamble.append(opt)

return preamble
# Filter out empty statements before returning
return list(filter(None, preamble))

def _run_command(self, cmd, timeout=None):
"""Run command cmd and re-raise any exception as a JobError."""
Expand Down
2 changes: 1 addition & 1 deletion reframe/core/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import abc


_RFM_TRAP_ERROR = '''
_RFM_TRAP_ERROR = r'''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Which python version are you running and you're getting the string warnings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pycodestyle shows me the warnings regarding invalid escape sequences. You must run with warnings enabled in order to take then from Python.

_onerror()
{
exitcode=$?
Expand Down
4 changes: 4 additions & 0 deletions unittests/test_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ def test_poll_before_submit(self):
self.testjob.prepare(self.commands, self.environs)
self.assertRaises(JobNotStartedError, self.testjob.finished)

def test_no_empty_lines_in_preamble(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be part of the _TestJob base class. Subclasses need not re-implement this, since it should be the same everywhere.

for l in self.testjob.emit_preamble():
self.assertNotEqual(l, '')


class TestLocalJob(_TestJob, unittest.TestCase):
def assertProcessDied(self, pid):
Expand Down