Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ language: python
python:
- "nightly"
- "pypy3"
- "3.9-dev"
- "3.8"
- "3.7"
- "3.6"
- "3.5"

cache: pip

Expand Down
11 changes: 11 additions & 0 deletions tests/actions.cnf
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions tests/test_MySQLdb_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,20 @@ def test_MULTIPOLYGON(self):
INSERT INTO test_MULTIPOLYGON
(id, border)
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)))'))
"""
)

c.execute("SELECT id, AsText(border) FROM test_MULTIPOLYGON")
c.execute("SELECT id, ST_AsText(border) FROM test_MULTIPOLYGON")
row = c.fetchone()
self.assertEqual(row[0], 1)
self.assertEqual(
row[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()
self.assertEqual(row[0], 1)
self.assertNotEqual(len(row[1]), 0)
Expand Down
1 change: 0 additions & 1 deletion tests/travis.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ host = 127.0.0.1
port = 3306
user = root
database = mysqldb_test
#password = travis
default-character-set = utf8mb4