mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 11:10:58 +08:00
Run tests in Github Actions (#457)
This commit is contained in:
36
.github/workflows/tests.yaml
vendored
Normal file
36
.github/workflows/tests.yaml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:8.0
|
||||||
|
ports:
|
||||||
|
- 3306:3306
|
||||||
|
env:
|
||||||
|
MYSQL_DATABASE: mysqldb_test
|
||||||
|
MYSQL_ROOT_PASSWORD: secretsecret
|
||||||
|
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Run tests
|
||||||
|
env:
|
||||||
|
TESTDB: actions.cnf
|
||||||
|
run: |
|
||||||
|
pip install -U pip
|
||||||
|
pip install -U mock coverage pytest pytest-cov
|
||||||
|
pip install .
|
||||||
|
pytest --cov ./MySQLdb
|
||||||
|
- uses: codecov/codecov-action@v1
|
@ -5,11 +5,6 @@ language: python
|
|||||||
python:
|
python:
|
||||||
- "nightly"
|
- "nightly"
|
||||||
- "pypy3"
|
- "pypy3"
|
||||||
- "3.9-dev"
|
|
||||||
- "3.8"
|
|
||||||
- "3.7"
|
|
||||||
- "3.6"
|
|
||||||
- "3.5"
|
|
||||||
|
|
||||||
cache: pip
|
cache: pip
|
||||||
|
|
||||||
|
11
tests/actions.cnf
Normal file
11
tests/actions.cnf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# To create your own custom version of this file, read
|
||||||
|
# http://dev.mysql.com/doc/refman/5.1/en/option-files.html
|
||||||
|
# and set TESTDB in your environment to the name of the file
|
||||||
|
|
||||||
|
[MySQLdb-tests]
|
||||||
|
host = 127.0.0.1
|
||||||
|
port = 3306
|
||||||
|
user = root
|
||||||
|
database = mysqldb_test
|
||||||
|
password = secretsecret
|
||||||
|
default-character-set = utf8mb4
|
@ -120,12 +120,12 @@ class test_MySQLdb(capabilities.DatabaseTest):
|
|||||||
INSERT INTO test_MULTIPOLYGON
|
INSERT INTO test_MULTIPOLYGON
|
||||||
(id, border)
|
(id, border)
|
||||||
VALUES (1,
|
VALUES (1,
|
||||||
Geomfromtext(
|
ST_Geomfromtext(
|
||||||
'MULTIPOLYGON(((1 1, 1 -1, -1 -1, -1 1, 1 1)),((1 1, 3 1, 3 3, 1 3, 1 1)))'))
|
'MULTIPOLYGON(((1 1, 1 -1, -1 -1, -1 1, 1 1)),((1 1, 3 1, 3 3, 1 3, 1 1)))'))
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
c.execute("SELECT id, AsText(border) FROM test_MULTIPOLYGON")
|
c.execute("SELECT id, ST_AsText(border) FROM test_MULTIPOLYGON")
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
self.assertEqual(row[0], 1)
|
self.assertEqual(row[0], 1)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -133,7 +133,7 @@ VALUES (1,
|
|||||||
"MULTIPOLYGON(((1 1,1 -1,-1 -1,-1 1,1 1)),((1 1,3 1,3 3,1 3,1 1)))",
|
"MULTIPOLYGON(((1 1,1 -1,-1 -1,-1 1,1 1)),((1 1,3 1,3 3,1 3,1 1)))",
|
||||||
)
|
)
|
||||||
|
|
||||||
c.execute("SELECT id, AsWKB(border) FROM test_MULTIPOLYGON")
|
c.execute("SELECT id, ST_AsWKB(border) FROM test_MULTIPOLYGON")
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
self.assertEqual(row[0], 1)
|
self.assertEqual(row[0], 1)
|
||||||
self.assertNotEqual(len(row[1]), 0)
|
self.assertNotEqual(len(row[1]), 0)
|
||||||
|
@ -7,5 +7,4 @@ host = 127.0.0.1
|
|||||||
port = 3306
|
port = 3306
|
||||||
user = root
|
user = root
|
||||||
database = mysqldb_test
|
database = mysqldb_test
|
||||||
#password = travis
|
|
||||||
default-character-set = utf8mb4
|
default-character-set = utf8mb4
|
||||||
|
Reference in New Issue
Block a user