Skip to content

Commit

Permalink
Fix regression, enable coveralls (#918)
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Jan 3, 2021
1 parent 8d0c6c2 commit 6ec449a
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 21 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

jobs:
build:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
Expand Down Expand Up @@ -50,5 +50,24 @@ jobs:
cp .travis/docker.json pymysql/tests/databases.json
- name: Run test
run: |
pip install -U cryptography PyNaCl pytest pytest-cov mock
pip install -U cryptography PyNaCl pytest pytest-cov mock coveralls
pytest -v --cov --cov-config .coveragerc pymysql
- name: Report coverage
run: coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
COVERALLS_PARALLEL: true

coveralls:
name: Finish coveralls
runs-on: ubuntu-20.04
needs: test
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion pymysql/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def _create_ssl_ctx(self, sslp):
elif isinstance(verify_mode_value, bool):
ctx.verify_mode = ssl.CERT_REQUIRED if verify_mode_value else ssl.CERT_NONE
else:
if isinstance(verify_mode_value, (text_type, str_type)):
if isinstance(verify_mode_value, str):
verify_mode_value = verify_mode_value.lower()
if verify_mode_value in ("none", "0", "false", "no"):
ctx.verify_mode = ssl.CERT_NONE
Expand Down
4 changes: 2 additions & 2 deletions pymysql/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ def escape_string(value, mapping=None):


def escape_bytes_prefixed(value, mapping=None):
return "_binary'%s'" % value.decode('ascii', 'surrogateescape')
return "_binary'%s'" % value.decode('ascii', 'surrogateescape').translate(_escape_table)


def escape_bytes(value, mapping=None):
return "'%s'" % value.decode('ascii', 'surrogateescape')
return "'%s'" % value.decode('ascii', 'surrogateescape').translate(_escape_table)


def escape_str(value, mapping=None):
Expand Down
1 change: 0 additions & 1 deletion pymysql/cursors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re

from . import err


Expand Down
3 changes: 0 additions & 3 deletions pymysql/tests/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def test_cleanup_rows_unbuffered(self):
break

del cursor
self.safe_gc_collect()

c2 = conn.cursor()

Expand All @@ -48,10 +47,8 @@ def test_cleanup_rows_buffered(self):
break

del cursor
self.safe_gc_collect()

c2 = conn.cursor()

c2.execute("select 1")

self.assertEqual(
Expand Down
18 changes: 6 additions & 12 deletions pymysql/tests/thirdparty/test_MySQLdb/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from time import time
import unittest

PY2 = sys.version_info[0] == 2

class DatabaseTest(unittest.TestCase):

Expand All @@ -24,10 +23,7 @@ def setUp(self):
self.connection = db
self.cursor = db.cursor()
self.BLOBText = ''.join([chr(i) for i in range(256)] * 100);
if PY2:
self.BLOBUText = unicode().join(unichr(i) for i in range(16834))
else:
self.BLOBUText = "".join(chr(i) for i in range(16834))
self.BLOBUText = "".join(chr(i) for i in range(16834))
data = bytearray(range(256)) * 16
self.BLOBBinary = self.db_module.Binary(data)

Expand Down Expand Up @@ -64,14 +60,12 @@ def new_table_name(self):
i = i + 1

def create_table(self, columndefs):
"""
Create a table using a list of column definitions given in columndefs.
""" Create a table using a list of column definitions given in
columndefs.
generator must be a function taking arguments (row_number,
col_number) returning a suitable data object for insertion
into the table.
generator must be a function taking arguments (row_number,
col_number) returning a suitable data object for insertion
into the table.
"""
self.table = self.new_table_name()
self.cursor.execute('CREATE TABLE %s (%s) %s' %
Expand Down

0 comments on commit 6ec449a

Please sign in to comment.