Skip to content

Commit

Permalink
Move from nose to pytest runner
Browse files Browse the repository at this point in the history
  • Loading branch information
xzkostyan committed Jun 13, 2022
1 parent 89f4059 commit f6444db
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 14 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
clickhouse-version:
- 22.5.1.2079
- 19.3.5
Expand All @@ -32,6 +33,10 @@ jobs:
run: |
pip install --upgrade pip setuptools wheel
pip install flake8 flake8-print coverage
python testsrequire.py
python setup.py develop
# Limit each test time execution.
pip install pytest-timeout
- name: Run flake8
run: flake8
- name: Setup /etc/hosts
Expand All @@ -46,7 +51,7 @@ jobs:
if [[ "${{ matrix.clickhouse-version }}" > "21.7" ]]; then echo "ORG=clickhouse"; else echo "ORG=yandex" ; fi >> tests/.env
docker-compose -f tests/docker-compose.yml up -d
- name: Run tests
run: coverage run --source=clickhouse_sqlalchemy setup.py test
run: coverage run --source=clickhouse_sqlalchemy -m py.test --timeout=10 -v
timeout-minutes: 2
- name: Set up Python for coverage submission
if: ${{ matrix.python-version == '2.7' }}
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/sa-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ jobs:
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Install test requirements
run: pip install --upgrade pip setuptools wheel
run: |
pip install --upgrade pip setuptools wheel
python testsrequire.py
python setup.py develop
# Limit each test time execution.
pip install pytest-timeout
- name: Install SQLAlchemy
run: pip install sqlalchemy==1.4.${{ matrix.sa-version }}
- name: Setup /etc/hosts
Expand All @@ -40,5 +45,5 @@ jobs:
if [[ "${{ matrix.clickhouse-version }}" > "21.7" ]]; then echo "ORG=clickhouse"; else echo "ORG=yandex" ; fi >> tests/.env
docker-compose -f tests/docker-compose.yml up -d
- name: Run tests
run: python setup.py test
run: py.test --timeout=10 -v
timeout-minutes: 2
11 changes: 8 additions & 3 deletions docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Running tests locally

Install desired Python version with system package manager/pyenv/another manager.

Install test requirements and build package:

.. code-block:: bash
python testsrequire.py && python setup.py develop
ClickHouse on host machine
^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand All @@ -23,8 +29,7 @@ your machine.
Run tests:

.. code-block:: bash
python setup.py test
py.test -v
ClickHouse in docker
^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -63,7 +68,7 @@ And run tests:

.. code-block:: bash
python setup.py test
py.test -v
``pip`` will automatically install all required modules for testing.

Expand Down
9 changes: 1 addition & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,5 @@ def read_version():
entry_points={
'sqlalchemy.dialects': dialects
},
test_suite='nose.collector',
tests_require=[
'nose',
'sqlalchemy>=1.4,<1.5',
'requests',
'responses',
'parameterized'
],
test_suite='pytest'
)
15 changes: 15 additions & 0 deletions testsrequire.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

tests_require = [
'pytest',
'sqlalchemy>=1.4,<1.5',
'requests',
'responses',
'parameterized'
]

try:
from pip import main as pipmain
except ImportError:
from pip._internal import main as pipmain

pipmain(['install'] + tests_require)

0 comments on commit f6444db

Please sign in to comment.