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
46 changes: 26 additions & 20 deletions docs/started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Requirements

* Python 3.5 or higher. Python 2 is not supported.

.. note::
.. note::
.. versionchanged:: 2.8
A functional TCL modules system is no more required. ReFrame can now operate without a modules system at all.

Optional
~~~~~~~~

* For running the unit tests of the framework, the `nose <https://pypi.python.org/pypi/nose>`__ Python module is needed.
* For running the unit tests of the framework, the `pytest <https://pytest.org/>`__ unittesting framework is needed.

You are advised to run the `unit tests <#running-the-unit-tests>`__ of the framework after installing it on a new system to make sure that everything works fine.

Expand Down Expand Up @@ -42,24 +42,30 @@ The output should look like the following:

.. code:: bash

test_check_failure (unittests.test_cli.TestFrontend) ... ok
test_check_sanity_failure (unittests.test_cli.TestFrontend) ... ok
test_check_submit_success (unittests.test_cli.TestFrontend) ... SKIP: job submission not supported
test_check_success (unittests.test_cli.TestFrontend) ... ok
test_checkpath_recursion (unittests.test_cli.TestFrontend) ... ok
test_custom_performance_check_failure (unittests.test_cli.TestFrontend) ... ok
...
test_copytree (unittests.test_utility.TestOSTools) ... ok
test_grep (unittests.test_utility.TestOSTools) ... ok
test_inpath (unittests.test_utility.TestOSTools) ... ok
test_subdirs (unittests.test_utility.TestOSTools) ... ok
test_always_true (unittests.test_utility.TestUtilityFunctions) ... ok
test_standard_threshold (unittests.test_utility.TestUtilityFunctions) ... ok

----------------------------------------------------------------------
Ran 235 tests in 33.842s

OK (SKIP=7)
collected 442 items

unittests/test_argparser.py .. [ 0%]
unittests/test_cli.py ....s........... [ 4%]
unittests/test_config.py ............... [ 7%]
unittests/test_deferrable.py .............................................. [ 17%]
unittests/test_environments.py sss...s..... [ 20%]
unittests/test_exceptions.py ............. [ 23%]
unittests/test_fields.py .................... [ 28%]
unittests/test_launchers.py .............. [ 31%]
unittests/test_loader.py ......... [ 33%]
unittests/test_logging.py ..................... [ 38%]
unittests/test_modules.py ........ssssssssssssssss............................ [ 49%]
unittests/test_pipeline.py ....s..s......................... [ 57%]
unittests/test_policies.py ............................... [ 64%]
unittests/test_runtime.py . [ 64%]
unittests/test_sanity_functions.py ............................................... [ 75%]
.............. [ 78%]
unittests/test_schedulers.py ..........s.s......ss...................s.s......ss. [ 90%]
unittests/test_script_builders.py . [ 90%]
unittests/test_utility.py ......................................... [ 99%]
unittests/test_versioning.py .. [100%]

======================== 411 passed, 31 skipped in 28.10 seconds =========================

You will notice in the output that all the job submission related tests have been skipped.
The test suite detects if the current system has a job submission system and is configured for ReFrame (see `Configuring ReFrame for your site <configure.html>`__) and it will skip all the unsupported unit tests.
Expand Down
4 changes: 2 additions & 2 deletions reframe/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class ReframeSyntaxError(ReframeError):
"""Raised when the syntax of regression tests is not correct."""


class TestLoadError(ReframeError):
class RegressionTestLoadError(ReframeError):
"""Raised when the regression test cannot be loaded."""


class NameConflictError(TestLoadError):
class NameConflictError(RegressionTestLoadError):
"""Raised when there is a name clash in the test suite."""


Expand Down
7 changes: 4 additions & 3 deletions reframe/frontend/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import reframe.core.debug as debug
import reframe.utility as util
from reframe.core.exceptions import NameConflictError, TestLoadError
from reframe.core.exceptions import NameConflictError, RegressionTestLoadError
from reframe.core.logging import getlogger


Expand Down Expand Up @@ -107,8 +107,9 @@ def load_from_module(self, module):
old_syntax = hasattr(module, '_get_checks')
new_syntax = hasattr(module, '_rfm_gettests')
if old_syntax and new_syntax:
raise TestLoadError('%s: mixing old and new regression test '
'syntax is not allowed' % module.__file__)
raise RegressionTestLoadError('%s: mixing old and new regression '
'test syntax is not allowed' %
module.__file__)

if not old_syntax and not new_syntax:
return []
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nose==1.3.7
pytest>=3.5.0
4 changes: 2 additions & 2 deletions test_reframe.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

import argparse
import nose
import pytest
import sys

import unittests.fixtures as fixtures
Expand All @@ -23,4 +23,4 @@
fixtures.init_runtime()

sys.argv = [sys.argv[0], *rem_args]
nose.main()
sys.exit(pytest.main())
16 changes: 8 additions & 8 deletions unittests/test_launchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def finished(self):
pass


class _TestLauncher(abc.ABC, unittest.TestCase):
class _TestLauncher(abc.ABC):
"""Base class for launcher tests."""

def setUp(self):
Expand Down Expand Up @@ -80,7 +80,7 @@ def test_emit_minimal_command(self):
self.assertEqual(self.expected_minimal_command, emitted_command)


class TestSrunLauncher(_TestLauncher):
class TestSrunLauncher(_TestLauncher, unittest.TestCase):
@property
def launcher(self):
return getlauncher('srun')(options=['--foo'])
Expand All @@ -94,7 +94,7 @@ def expected_minimal_command(self):
return 'srun --foo ls -l'


class TestSrunallocLauncher(_TestLauncher):
class TestSrunallocLauncher(_TestLauncher, unittest.TestCase):

@property
def launcher(self):
Expand Down Expand Up @@ -136,7 +136,7 @@ def expected_minimal_command(self):
'ls -l')


class TestAlpsLauncher(_TestLauncher):
class TestAlpsLauncher(_TestLauncher, unittest.TestCase):
@property
def launcher(self):
return getlauncher('alps')(options=['--foo'])
Expand All @@ -150,7 +150,7 @@ def expected_minimal_command(self):
return 'aprun -B --foo ls -l'


class TestMpirunLauncher(_TestLauncher):
class TestMpirunLauncher(_TestLauncher, unittest.TestCase):
@property
def launcher(self):
return getlauncher('mpirun')(options=['--foo'])
Expand All @@ -164,7 +164,7 @@ def expected_minimal_command(self):
return 'mpirun -np 1 --foo ls -l'


class TestMpiexecLauncher(_TestLauncher):
class TestMpiexecLauncher(_TestLauncher, unittest.TestCase):
@property
def launcher(self):
return getlauncher('mpiexec')(options=['--foo'])
Expand All @@ -178,7 +178,7 @@ def expected_minimal_command(self):
return 'mpiexec -n 1 --foo ls -l'


class TestLauncherWrapperAlps(_TestLauncher):
class TestLauncherWrapperAlps(_TestLauncher, unittest.TestCase):
@property
def launcher(self):
return launchers.LauncherWrapper(
Expand All @@ -195,7 +195,7 @@ def expected_minimal_command(self):
return 'ddt --offline aprun -B --foo ls -l'


class TestLocalLauncher(_TestLauncher):
class TestLocalLauncher(_TestLauncher, unittest.TestCase):
@property
def launcher(self):
return getlauncher('local')(['--foo'])
Expand Down
6 changes: 3 additions & 3 deletions unittests/test_loader.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import unittest

from reframe.core.exceptions import (ConfigError,
NameConflictError, TestLoadError)
from reframe.core.exceptions import (ConfigError, NameConflictError,
RegressionTestLoadError)
from reframe.core.systems import System
from reframe.frontend.loader import RegressionCheckLoader

Expand Down Expand Up @@ -48,7 +48,7 @@ def test_load_new_syntax(self):
self.assertEqual(13, len(checks))

def test_load_mixed_syntax(self):
self.assertRaises(TestLoadError, self.loader.load_from_file,
self.assertRaises(RegressionTestLoadError, self.loader.load_from_file,
'unittests/resources/checks_unlisted/mixed.py')

def test_conflicted_checks(self):
Expand Down
10 changes: 5 additions & 5 deletions unittests/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from unittests.fixtures import TEST_MODULES


class _TestModulesSystem(unittest.TestCase):
class _TestModulesSystem:
def setUp(self):
self.environ_save = EnvironmentSnapshot()
self.modules_system.searchpath_add(TEST_MODULES)
Expand Down Expand Up @@ -100,7 +100,7 @@ def test_emit_unload_commands(self):
self.modules_system.emit_unload_commands('m0'))


class TestTModModulesSystem(_TestModulesSystem):
class TestTModModulesSystem(_TestModulesSystem, unittest.TestCase):
def setUp(self):
try:
self.modules_system = modules.ModulesSystem.create('tmod')
Expand All @@ -116,7 +116,7 @@ def expected_unload_instr(self, module):
return 'module unload %s' % module


class TestTMod4ModulesSystem(_TestModulesSystem):
class TestTMod4ModulesSystem(_TestModulesSystem, unittest.TestCase):
def setUp(self):
try:
self.modules_system = modules.ModulesSystem.create('tmod4')
Expand All @@ -132,7 +132,7 @@ def expected_unload_instr(self, module):
return 'module unload %s' % module


class TestLModModulesSystem(_TestModulesSystem):
class TestLModModulesSystem(_TestModulesSystem, unittest.TestCase):
def setUp(self):
try:
self.modules_system = modules.ModulesSystem.create('lmod')
Expand All @@ -148,7 +148,7 @@ def expected_unload_instr(self, module):
return 'module unload %s' % module


class TestNoModModulesSystem(_TestModulesSystem):
class TestNoModModulesSystem(_TestModulesSystem, unittest.TestCase):
def setUp(self):
try:
self.modules_system = modules.ModulesSystem.create()
Expand Down
6 changes: 3 additions & 3 deletions unittests/test_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from reframe.core.shell import BashScriptBuilder


class _TestJob(unittest.TestCase):
class _TestJob:
def setUp(self):
self.workdir = tempfile.mkdtemp(dir='unittests')
self.testjob = self.job_type(
Expand Down Expand Up @@ -144,7 +144,7 @@ def test_poll_before_submit(self):
self.assertRaises(JobNotStartedError, self.testjob.finished)


class TestLocalJob(_TestJob):
class TestLocalJob(_TestJob, unittest.TestCase):
def assertProcessDied(self, pid):
try:
os.kill(pid, 0)
Expand Down Expand Up @@ -259,7 +259,7 @@ def test_cancel_term_ignore(self):
self.assertProcessDied(sleep_pid)


class TestSlurmJob(_TestJob):
class TestSlurmJob(_TestJob, unittest.TestCase):
@property
def sched_name(self):
return 'slurm'
Expand Down