Skip to content

Commit

Permalink
Remove runtest.py script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Some User committed Dec 26, 2022
1 parent cbf68e5 commit c249e79
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 208 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ jobs:
- name: Run tests
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
pytest -n=logical -x --cov grab --cov-report term-missing
else
coverage run runtest.py --test-all --backend=mongodb,pyquery
fi
pytest -n=logical -x --cov grab --cov-report term-missing
coverage lcov -o .coverage.lcov
- name: Coveralls Parallel
Expand Down
35 changes: 12 additions & 23 deletions docs/usage/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,30 @@ Run command:
make bootstrap
Run tests
---------

Fastest way to run all Grab tests
---------------------------------

.. code:: shell
Run all tests in 30 parallel threads::

pytest -n30

Classic way to run tests
------------------------
Run all tests in 30 parallel threads, fail on first error::

Run the commands:

.. code:: shell
pytest -n30 -x

./runtest.py --test-all --backend=mongodb,redis,pyquery
Same as previous but via make command::

With runtestpy you can choose which set of tests to run. Available runtest.py options::

--test-grab - Grab API tests
--test-spider - Grab::Spider API tests
--test-all - shortcut to run both Grab and Grab::Spider tests
--backend=redis - enable tests of things that work with redis
--backend=mysql - enable tests of things that work with mysql
--backend=mongodb - enable tests of things that work with mongo
--backend=pyquery - enable tests of things that work with pyquery
make pytest

If you want to run specific test cases then use the `-t` option. For example:
Run specific test::

.. code:: shell
pytest tests/test_util_types.py

./runtest.py -t test.grab_api
Run all test cases which has "redis" in their name::

pytest -k redis

.. _usage_testing_travis:
.. _usage_testing_github:

Github Testing
--------------
Expand Down
177 changes: 0 additions & 177 deletions runtest.py

This file was deleted.

5 changes: 5 additions & 0 deletions tests/test_spider_queue.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
from abc import abstractmethod
from typing import Any, cast
from unittest import TestCase

import pytest
from test_server import Response

from grab.errors import GrabFeatureIsDeprecated
Expand All @@ -11,6 +13,8 @@
from grab.spider.queue_backend.memory import MemoryTaskQueue
from tests.util import BaseTestCase, load_test_config

skip_on_windows = pytest.mark.skipif(os.name == "nt", reason="does not work on windows")


class SpiderQueueMixin:
class SimpleSpider(Spider):
Expand Down Expand Up @@ -152,6 +156,7 @@ def test_clear_collection(self) -> None:
bot.task_queue.clear()


@skip_on_windows
class SpiderRedisQueueTestCase(SpiderQueueMixin, BaseTestCase):
backend = "redis"

Expand Down
3 changes: 0 additions & 3 deletions tests/test_util_types.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import sys
from unittest import TestCase

import pytest

from grab import HttpClient
from grab.transport import Urllib3Transport
from grab.util.types import resolve_entity
Expand Down

0 comments on commit c249e79

Please sign in to comment.