Ignore:
Timestamp:
Jul 27, 2016, 10:54:56 PM (4 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Remove `unittest` dependency

- Remove `unittest` imports

- Let test case classes inherit from `object` instead of
  `unittest.TestCase`

- Use `setup_method` and `teardown_method` instead of
  `unittest`'s `setUp` and `tearDown`

- Use `pytest.mark.skipif` instead of `unittest.skipIf`

- Use `pytest.mark.slow_test` instead of decorator in
  `test/__init__.py`. Exclude slow tests with

    py.test -m "not slow_test" test

- Replace some leftover `assert*` calls with `assert`
  statements

- Replace `assert False, ...` with `pytest.fail`

ticket: 98
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/__init__.py

    r1565 r1663  
    1 """
    2 Setup for unit tests.
    3 """
    4 
    5 from __future__ import unicode_literals
    6 
    7 import os
    8 import unittest
    9 
    10 
    11 __all__ = ["skip_long_running_test"]
    12 
    13 
    14 def skip_long_running_test_condition():
    15     """
    16     Helper function to use with `unittest.skipIf`.
    17 
    18     This requires either Python >= 2.7 or the standalone `unittest2`
    19     module.
    20     """
    21     skip_flag = os.environ.get("SKIP_LONG_RUNNING_TESTS", "0")
    22     return skip_flag == "1"
    23 
    24 
    25 skip_long_running_test = unittest.skipIf(skip_long_running_test_condition(),
    26                                          "skipping long-running test")
Note: See TracChangeset for help on using the changeset viewer.