Skip to content

Commit 329bae7

Browse files
authored
Run tests in Github Actions (#457)
1 parent 3431f56 commit 329bae7

File tree

5 files changed

+50
-9
lines changed

5 files changed

+50
-9
lines changed

.github/workflows/tests.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-20.04
10+
strategy:
11+
matrix:
12+
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
13+
services:
14+
mysql:
15+
image: mysql:8.0
16+
ports:
17+
- 3306:3306
18+
env:
19+
MYSQL_DATABASE: mysqldb_test
20+
MYSQL_ROOT_PASSWORD: secretsecret
21+
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Run tests
29+
env:
30+
TESTDB: actions.cnf
31+
run: |
32+
pip install -U pip
33+
pip install -U mock coverage pytest pytest-cov
34+
pip install .
35+
pytest --cov ./MySQLdb
36+
- uses: codecov/codecov-action@v1

.travis.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ language: python
55
python:
66
- "nightly"
77
- "pypy3"
8-
- "3.9-dev"
9-
- "3.8"
10-
- "3.7"
11-
- "3.6"
12-
- "3.5"
138

149
cache: pip
1510

tests/actions.cnf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To create your own custom version of this file, read
2+
# http://dev.mysql.com/doc/refman/5.1/en/option-files.html
3+
# and set TESTDB in your environment to the name of the file
4+
5+
[MySQLdb-tests]
6+
host = 127.0.0.1
7+
port = 3306
8+
user = root
9+
database = mysqldb_test
10+
password = secretsecret
11+
default-character-set = utf8mb4

tests/test_MySQLdb_capabilities.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,20 +120,20 @@ def test_MULTIPOLYGON(self):
120120
INSERT INTO test_MULTIPOLYGON
121121
(id, border)
122122
VALUES (1,
123-
Geomfromtext(
123+
ST_Geomfromtext(
124124
'MULTIPOLYGON(((1 1, 1 -1, -1 -1, -1 1, 1 1)),((1 1, 3 1, 3 3, 1 3, 1 1)))'))
125125
"""
126126
)
127127

128-
c.execute("SELECT id, AsText(border) FROM test_MULTIPOLYGON")
128+
c.execute("SELECT id, ST_AsText(border) FROM test_MULTIPOLYGON")
129129
row = c.fetchone()
130130
self.assertEqual(row[0], 1)
131131
self.assertEqual(
132132
row[1],
133133
"MULTIPOLYGON(((1 1,1 -1,-1 -1,-1 1,1 1)),((1 1,3 1,3 3,1 3,1 1)))",
134134
)
135135

136-
c.execute("SELECT id, AsWKB(border) FROM test_MULTIPOLYGON")
136+
c.execute("SELECT id, ST_AsWKB(border) FROM test_MULTIPOLYGON")
137137
row = c.fetchone()
138138
self.assertEqual(row[0], 1)
139139
self.assertNotEqual(len(row[1]), 0)

tests/travis.cnf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ host = 127.0.0.1
77
port = 3306
88
user = root
99
database = mysqldb_test
10-
#password = travis
1110
default-character-set = utf8mb4

0 commit comments

Comments
 (0)