Skip to content

Commit 6ec449a

Browse files
authored
Fix regression, enable coveralls (PyMySQL#918)
1 parent 8d0c6c2 commit 6ec449a

File tree

6 files changed

+30
-21
lines changed

6 files changed

+30
-21
lines changed

.github/workflows/test.yaml

+21-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
pull_request:
66

77
jobs:
8-
build:
8+
test:
99
runs-on: ubuntu-20.04
1010
strategy:
1111
matrix:
@@ -50,5 +50,24 @@ jobs:
5050
cp .travis/docker.json pymysql/tests/databases.json
5151
- name: Run test
5252
run: |
53-
pip install -U cryptography PyNaCl pytest pytest-cov mock
53+
pip install -U cryptography PyNaCl pytest pytest-cov mock coveralls
5454
pytest -v --cov --cov-config .coveragerc pymysql
55+
- name: Report coverage
56+
run: coveralls
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
60+
COVERALLS_PARALLEL: true
61+
62+
coveralls:
63+
name: Finish coveralls
64+
runs-on: ubuntu-20.04
65+
needs: test
66+
container: python:3-slim
67+
steps:
68+
- name: Finished
69+
run: |
70+
pip3 install --upgrade coveralls
71+
coveralls --finish
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pymysql/connections.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def _create_ssl_ctx(self, sslp):
341341
elif isinstance(verify_mode_value, bool):
342342
ctx.verify_mode = ssl.CERT_REQUIRED if verify_mode_value else ssl.CERT_NONE
343343
else:
344-
if isinstance(verify_mode_value, (text_type, str_type)):
344+
if isinstance(verify_mode_value, str):
345345
verify_mode_value = verify_mode_value.lower()
346346
if verify_mode_value in ("none", "0", "false", "no"):
347347
ctx.verify_mode = ssl.CERT_NONE

pymysql/converters.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ def escape_string(value, mapping=None):
7474

7575

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

7979

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

8383

8484
def escape_str(value, mapping=None):

pymysql/cursors.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import re
2-
32
from . import err
43

54

pymysql/tests/test_cursor.py

-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def test_cleanup_rows_unbuffered(self):
3030
break
3131

3232
del cursor
33-
self.safe_gc_collect()
3433

3534
c2 = conn.cursor()
3635

@@ -48,10 +47,8 @@ def test_cleanup_rows_buffered(self):
4847
break
4948

5049
del cursor
51-
self.safe_gc_collect()
5250

5351
c2 = conn.cursor()
54-
5552
c2.execute("select 1")
5653

5754
self.assertEqual(

pymysql/tests/thirdparty/test_MySQLdb/capabilities.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from time import time
99
import unittest
1010

11-
PY2 = sys.version_info[0] == 2
1211

1312
class DatabaseTest(unittest.TestCase):
1413

@@ -24,10 +23,7 @@ def setUp(self):
2423
self.connection = db
2524
self.cursor = db.cursor()
2625
self.BLOBText = ''.join([chr(i) for i in range(256)] * 100);
27-
if PY2:
28-
self.BLOBUText = unicode().join(unichr(i) for i in range(16834))
29-
else:
30-
self.BLOBUText = "".join(chr(i) for i in range(16834))
26+
self.BLOBUText = "".join(chr(i) for i in range(16834))
3127
data = bytearray(range(256)) * 16
3228
self.BLOBBinary = self.db_module.Binary(data)
3329

@@ -64,14 +60,12 @@ def new_table_name(self):
6460
i = i + 1
6561

6662
def create_table(self, columndefs):
63+
"""
64+
Create a table using a list of column definitions given in columndefs.
6765
68-
""" Create a table using a list of column definitions given in
69-
columndefs.
70-
71-
generator must be a function taking arguments (row_number,
72-
col_number) returning a suitable data object for insertion
73-
into the table.
74-
66+
generator must be a function taking arguments (row_number,
67+
col_number) returning a suitable data object for insertion
68+
into the table.
7569
"""
7670
self.table = self.new_table_name()
7771
self.cursor.execute('CREATE TABLE %s (%s) %s' %

0 commit comments

Comments
 (0)