Skip to content

Conversation

@teojgo
Copy link
Contributor

@teojgo teojgo commented Mar 28, 2018

  • Move unittest.TestCase inheritance to the actual test
    classes.

Closes #111.
Related to #134

Copy link
Contributor

@vkarak vkarak left a comment

Choose a reason for hiding this comment

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

It seems that not all the tests are run on for both the generic and the CSCS settings (it could be simply the counting of the tests, but we need to investigate):

  • CSCS settings on master:
Ran 402 tests in 85.897s

OK (SKIP=8)
  • CSCS settings with pytest:
Ran 387 tests in 101.403s

OK (SKIP=8)
  • Generic settings on master:
Ran 387 tests in 77.355s
OK (SKIP=21)
  • Generic settings with pytest
Ran 387 tests in 117.708s
OK (SKIP=27)

@teojgo teojgo changed the title Make unittests compatible with pytest [WIP] Make unittests compatible with pytest Mar 29, 2018
- pip install -r requirements.txt

script:
./test_reframe.py
Copy link
Contributor

Choose a reason for hiding this comment

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

We will need to be able to run the the tests with ./test_reframe.py passing any options to pytest. We can achieve this by calling pytest.main() instead of nose.main inside the test_reframe.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I know but first we must add also pytest to corresponding Python bare module.

Copy link
Contributor

Choose a reason for hiding this comment

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

In any case we should add it to the requirements.txt, so that anybody can run the unit tests.

@teojgo
Copy link
Contributor Author

teojgo commented Mar 29, 2018

@vkarak I have tried with all the possible settings and I always get 387 tests with either pytest or nose.

@vkarak
Copy link
Contributor

vkarak commented Mar 30, 2018

@teojgo I've checked again the current status of this branch and the master and both run the same number of unit tests. So, it's fine from this point of view.

requirements.txt Outdated
@@ -1 +1,3 @@
nose==1.3.7
Copy link
Contributor

Choose a reason for hiding this comment

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

We should remove nose now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I have also a module for python bare ready.

Copy link
Contributor

Choose a reason for hiding this comment

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

As soon as this is fixed, this PR is fine for me. We could though postpone its merging until the Python-bare module is fixed. The only thing is that we should perhaps add some additional pytest plugins in Python-bare, although we don't use them now, so as not to have to update this module every time.

@teojgo
Copy link
Contributor Author

teojgo commented Apr 4, 2018

The corresponding module which adds support for pytest is here: eth-cscs/production#568

@vkarak vkarak added this to the Upcoming sprint milestone Apr 16, 2018
@teojgo teojgo changed the title [WIP] Make unittests compatible with pytest Make unittests compatible with pytest Apr 19, 2018
@teojgo teojgo changed the title Make unittests compatible with pytest [Wip] Make unittests compatible with pytest Apr 19, 2018
@vkarak vkarak changed the title [Wip] Make unittests compatible with pytest [WIP] Make unittests compatible with pytest Apr 19, 2018
@teojgo teojgo force-pushed the enhancement/pytest_friendly_tests branch from 638684b to c2dfccb Compare April 20, 2018 07:07
@vkarak
Copy link
Contributor

vkarak commented Apr 30, 2018

Moved to the next sprint; it needs a fix from the big PR for new style checks and the unit tests refactoring.

@vkarak vkarak modified the milestones: ReFrame sprint 2018w16, Upcoming sprint Apr 30, 2018
* Change exception name `TestLoadError` to `LoadTestError` so that
  pytest doesn't treat it as a test.

* Stop inheriting from `unittest.TestCase` in abstract classes used in
  test files.

* Update documentation and requirements.

* Use pytest inside the `test_reframe.py` script.
@teojgo teojgo force-pushed the enhancement/pytest_friendly_tests branch from c2dfccb to 39b8da4 Compare May 24, 2018 09:52
@teojgo teojgo changed the title [WIP] Make unittests compatible with pytest Make unittests compatible with pytest May 24, 2018


class TestLoadError(ReframeError):
class LoadTestError(ReframeError):
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest naming this RegressionTestLoadError.

'syntax is not allowed' % module.__file__)
raise RegressionTestLoadError('%s: mixing old and new regression '
'test syntax is not allowed'
% module.__file__)
Copy link
Contributor

Choose a reason for hiding this comment

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

We split lines after the operators, but never mind.

@vkarak vkarak merged commit c6bc5c9 into master May 29, 2018
@vkarak vkarak deleted the enhancement/pytest_friendly_tests branch May 29, 2018 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants