Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit 2e06268

Browse files
committed
resolve conflicts
changing cache path try coverage pattern use commit hash in cache key fix workflow syntax add checkout to coverage switch to artifacts Update condition change `if` syntax switch condition test update update update update update add grouping skipif tests update temp temp update remove temp
1 parent 3807baf commit 2e06268

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

.github/workflows/test-suite.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,25 @@ jobs:
4747

4848
steps:
4949
- uses: "actions/checkout@v2"
50-
- uses: actions/cache@v2
51-
with:
52-
path: .
53-
key: ${{ runner.os }}-python${{ matrix.python-version }}
5450
- uses: "actions/setup-python@v1"
5551
with:
5652
python-version: "${{ matrix.python-version }}"
57-
database-url: "${{ matrix.database-url }}"
5853
- name: "Install dependencies"
5954
run: "scripts/install"
6055
- name: "Run linting checks"
6156
run: "scripts/check"
6257
- name: "Build package & docs"
6358
run: "scripts/build"
6459
- name: "Run tests"
65-
env:
60+
if: ${{ matrix.python-version != '3.6' || matrix.database-url != 'mysql+asyncmy://username:password@localhost:3306/testsuite' }}
61+
env:
6662
TEST_DATABASE_URL: "${{ matrix.database-url }}"
67-
if: ${{ matrix.python-version != '3.6' && matrix.database-url != 'mysql+asyncmy://username:password@localhost:3306/testsuite' }}
6863
run: "scripts/test"
64+
- name: Upload code coverage results
65+
uses: actions/upload-artifact@v2
66+
with:
67+
name: code-coverage-results
68+
path: .coverage.*
6969

7070
coverage:
7171
name: "Python ${{ matrix.python-version }}"
@@ -77,11 +77,12 @@ jobs:
7777
python-version: ["3.6", "3.7", "3.8", "3.9"]
7878

7979
steps:
80-
- uses: actions/cache@v2
80+
- uses: "actions/checkout@v2"
81+
- name: Download code coverage results
82+
uses: actions/download-artifact@v2
8183
with:
82-
path: .
83-
key: ${{ runner.os }}-python${{ matrix.python-version }}
84-
- name: test
85-
run: "ls"
84+
name: code-coverage-results
85+
- name: "Install coverage.py"
86+
run: "pip install coverage"
8687
- name: "Enforce coverage"
87-
run: "./home/runner/work/databases/databases/scripts/coverage"
88+
run: "./scripts/coverage"

tests/test_connection_options.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
"""
22
Unit tests for the backend connection arguments.
33
"""
4+
import sys
5+
6+
import pytest
47

58
from databases.backends.aiopg import AiopgBackend
6-
from databases.backends.asyncmy import AsyncMyBackend
79
from databases.backends.mysql import MySQLBackend
810
from databases.backends.postgres import PostgresBackend
911
from databases.core import DatabaseURL
1012
from tests.test_databases import DATABASE_URL, async_adapter
1113

14+
if sys.version_info >= (3, 7): # pragma: no cover
15+
from databases.backends.asyncmy import AsyncMyBackend
16+
1217

1318
def test_postgres_pool_size():
1419
backend = PostgresBackend("postgres://localhost/database?min_size=1&max_size=20")
@@ -90,6 +95,7 @@ def test_mysql_pool_recycle():
9095
assert kwargs == {"pool_recycle": 20}
9196

9297

98+
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
9399
def test_asyncmy_pool_size():
94100
backend = AsyncMyBackend(
95101
"mysql+asyncmy://localhost/database?min_size=1&max_size=20"
@@ -98,24 +104,28 @@ def test_asyncmy_pool_size():
98104
assert kwargs == {"minsize": 1, "maxsize": 20}
99105

100106

107+
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
101108
def test_asyncmy_explicit_pool_size():
102109
backend = AsyncMyBackend("mysql://localhost/database", min_size=1, max_size=20)
103110
kwargs = backend._get_connection_kwargs()
104111
assert kwargs == {"minsize": 1, "maxsize": 20}
105112

106113

114+
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
107115
def test_asyncmy_ssl():
108116
backend = AsyncMyBackend("mysql+asyncmy://localhost/database?ssl=true")
109117
kwargs = backend._get_connection_kwargs()
110118
assert kwargs == {"ssl": True}
111119

112120

121+
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
113122
def test_asyncmy_explicit_ssl():
114123
backend = AsyncMyBackend("mysql+asyncmy://localhost/database", ssl=True)
115124
kwargs = backend._get_connection_kwargs()
116125
assert kwargs == {"ssl": True}
117126

118127

128+
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
119129
def test_asyncmy_pool_recycle():
120130
backend = AsyncMyBackend("mysql+asyncmy://localhost/database?pool_recycle=20")
121131
kwargs = backend._get_connection_kwargs()

tests/test_databases.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616
DATABASE_URL = os.environ["TEST_DATABASE_URL"]
1717

1818

19-
class AsyncMock(MagicMock):
20-
async def __call__(self, *args, **kwargs):
21-
return super(AsyncMock, self).__call__(*args, **kwargs)
22-
23-
2419
class AsyncMock(MagicMock):
2520
async def __call__(self, *args, **kwargs):
2621
return super(AsyncMock, self).__call__(*args, **kwargs)

0 commit comments

Comments
 (0)