diff --git a/README-dev.rst b/README-dev.rst index adca510412..195da1054c 100644 --- a/README-dev.rst +++ b/README-dev.rst @@ -131,7 +131,7 @@ Then, browse to `localhost:8000 `_. Tests ===== -Running Unit Tests +Running Nose Unit Tests ------------------ Unit tests can be run like so:: @@ -141,6 +141,16 @@ You can run a specific test method like so:: nosetests -w tests/unit/test_connection.py:ConnectionTest.test_bad_protocol_version +Running PyTest Unit Tests +------------------ +Unit tests can be run like so:: + + pytest tests/unit/ + +You can run a specific test method like so:: + + pytest tests/unit/test_connection.py::ConnectionTest::test_bad_protocol_version + Running Integration Tests ------------------------- In order to run integration tests, you must specify a version to run using the ``CASSANDRA_VERSION`` or ``DSE_VERSION`` environment variable:: @@ -170,14 +180,14 @@ Sometimes it's useful to output logs for the tests as they run:: nosetests -w tests/unit/ --nocapture --nologcapture -Use tee to capture logs and see them on your terminal:: + or - nosetests -w tests/unit/ --nocapture --nologcapture 2>&1 | tee test.log + pytest tests/unit --log-file=test.log Testing Multiple Python Versions -------------------------------- -Use tox to test all of Python 3.8 through 3.12 and pypy (this is what -TravisCI runs):: + +Use tox to test all of Python 3.8 through 3.12 and pypy (this is what TravisCI runs):: tox diff --git a/test-requirements.txt b/test-requirements.txt index e3f8e1cac6..3376a6cd2a 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,7 @@ -r requirements.txt scales pynose +pytest mock>1.1 ccm>=2.1.2 pytz diff --git a/tests/unit/test_host_connection_pool.py b/tests/unit/test_host_connection_pool.py index 86d4bf9843..fb47e7c6af 100644 --- a/tests/unit/test_host_connection_pool.py +++ b/tests/unit/test_host_connection_pool.py @@ -24,6 +24,7 @@ from cassandra.policies import HostDistance, SimpleConvictionPolicy class _PoolTests(unittest.TestCase): + __test__ = False PoolImpl = None uses_single_connection = None @@ -205,6 +206,7 @@ def test_host_equality(self): class HostConnectionPoolTests(_PoolTests): + __test__ = True PoolImpl = HostConnectionPool uses_single_connection = False @@ -253,6 +255,7 @@ def get_conn(): class HostConnectionTests(_PoolTests): + __test__ = True PoolImpl = HostConnection uses_single_connection = True