diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..5b69b41 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -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 diff --git a/.travis.yml b/.travis.yml index f77d5e0..75c6d42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,6 @@ language: python python: - "nightly" - "pypy3" - - "3.9-dev" - - "3.8" - - "3.7" - - "3.6" - - "3.5" cache: pip diff --git a/tests/actions.cnf b/tests/actions.cnf new file mode 100644 index 0000000..8918f03 --- /dev/null +++ b/tests/actions.cnf @@ -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 diff --git a/tests/test_MySQLdb_capabilities.py b/tests/test_MySQLdb_capabilities.py index fe9ef03..0b4dd21 100644 --- a/tests/test_MySQLdb_capabilities.py +++ b/tests/test_MySQLdb_capabilities.py @@ -120,12 +120,12 @@ class test_MySQLdb(capabilities.DatabaseTest): 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( @@ -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)))", ) - 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) diff --git a/tests/travis.cnf b/tests/travis.cnf index 05ff803..5fd6f84 100644 --- a/tests/travis.cnf +++ b/tests/travis.cnf @@ -7,5 +7,4 @@ host = 127.0.0.1 port = 3306 user = root database = mysqldb_test -#password = travis default-character-set = utf8mb4