Skip to content

Commit b24bf0b

Browse files
authored
Merge pull request #214 from kneasle/different-py-version
Test Python 3.6, 3.8, 3.11 on CI
2 parents f456233 + df64c2b commit b24bf0b

20 files changed

+88
-52
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
os: [ubuntu-20.04, windows-latest]
22-
python-version: [3.6, 3.9]
22+
python-version: [3.6, 3.8, 3.11]
2323

2424
steps:
2525
- uses: actions/checkout@v1

.pylintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[MESSAGES CONTROL]
22

33
disable=broad-except,len-as-condition,logging-fstring-interpolation,logging-not-lazy,unexpected-line-ending-format,duplicate-code
4+
load-plugins=pylint.extensions.no_self_use
45

56
[FORMAT]
67

doctests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def main():
160160
return
161161

162162
print("ERRORS FOUND:")
163-
for (location, command, e) in errors:
163+
for location, command, e in errors:
164164
print("\n")
165165
print(f" >>> {location}: {command}")
166166

requirements.txt

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1+
black==22.8.0
12
certifi==2022.12.7
2-
chardet==3.0.4
3-
idna==2.9
4-
numpy==1.23.4; python_version >= '3.8'
3+
chardet==5.0.0
4+
idna==3.4
5+
numpy==1.24.2; python_version >= '3.8'
56
numpy==1.19.5; python_version < '3.8'
6-
mypy==0.790
7-
mypy-extensions==0.4.3
8-
pylint==2.8.3
9-
pytest==5.4.3
10-
black==21.4b1
7+
mypy==1.0.1; python_version >= '3.8'
8+
mypy-extensions==1.0.0; python_version >= '3.8'
9+
mypy==0.790; python_version < '3.8'
10+
mypy-extensions==0.4.3; python_version < '3.8'
11+
pylint==2.16.2; python_version >= '3.8'
12+
pylint==2.13.9; python_version < '3.8'
13+
pytest==7.2.1; python_version >= '3.8'
14+
pytest==7.0.1; python_version < '3.8'
1115
python-engineio==3.14.2
1216
python-socketio==4.6.1
13-
requests==2.25.0
14-
six==1.15.0
15-
urllib3==1.26.5
16-
websocket-client==0.57.0
17+
requests==2.27.1
18+
six==1.16.0
19+
types-requests==2.28.11.14
20+
types-urllib3==1.26.25.7
21+
urllib3==1.26.14
22+
websocket-client==1.5.1; python_version >= '3.8'
23+
websocket-client==1.3.1; python_version < '3.8'

run-checks.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
import mypy.api
66
import pytest
7-
from pylint import epylint as lint
7+
from io import StringIO
8+
from pylint.lint import Run as run_pylint
9+
from pylint.reporters.text import TextReporter
810
import sys
911

1012
import doctests
@@ -78,13 +80,18 @@ def __exit__(self, exc_type, exc_val, exc_tb):
7880
if run_all or parsed_args.lint:
7981
with Check("Linting"):
8082
print("python -m pylint wheatley")
81-
pylint_args = "wheatley"
83+
pylint_args = ["wheatley"]
8284
if os.name != "nt":
83-
pylint_args += " --enable=unexpected-line-ending-format"
84-
(pylint_stdout, pylint_stderr) = lint.py_run(pylint_args, return_std=True)
85-
output = pylint_stdout.getvalue()
85+
pylint_args.append("--enable=unexpected-line-ending-format")
86+
87+
# Custom open stream
88+
pylint_output = StringIO()
89+
reporter = TextReporter(pylint_output)
90+
91+
run_pylint(pylint_args, reporter=reporter, exit=False)
92+
93+
output = pylint_output.getvalue()
8694
print(output)
87-
print(pylint_stderr.getvalue(), file=sys.stderr)
8895
success = output.find("Your code has been rated at 10")
8996
if success == -1:
9097
exit(1)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
],
2828
python_requires=">=3.6",
2929
install_requires=[
30-
'numpy<=1.19.3; platform_system == "Windows"',
31-
'numpy; platform_system != "Windows"',
30+
'numpy==1.19.5; python_version < "3.8"',
31+
'numpy; python_version >= "3.8"',
3232
"requests",
3333
"python-socketio<5",
3434
"python-engineio<4",

tests/row_generation/test_ComplibCompositionRowGenerator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class CompLibGeneratorTests(TestCase):
99
def test_comp_fetching(self):
10-
for (url, expected_title) in [
10+
for url, expected_title in [
1111
("complib.org/composition/62355", "5040 Plain Bob Major by Ben White-Horne"),
1212
("www.complib.org/composition/62355", "5040 Plain Bob Major by Ben White-Horne"),
1313
("https://www.complib.org/composition/71994", "110 2-Spliced Major"),

tests/row_generation/test_Helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_convert_pn(self):
7373
(".-.-.1.-.2", [_CROSS_PN, _CROSS_PN, [1], _CROSS_PN, [2]]),
7474
]
7575

76-
for (input_pn, expected_output_pn) in test_cases:
76+
for input_pn, expected_output_pn in test_cases:
7777
with self.subTest(input_pn=input_pn, expected_output_pn=expected_output_pn):
7878
self.assertEqual(convert_pn(input_pn), expected_output_pn)
7979

tests/row_generation/test_MethodPlaceNotationGenerator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_grandsire__all_stages_above_4(self):
8686
("Grandsire Maximus", 12),
8787
]
8888

89-
for (method_title, expected_stage) in test_cases:
89+
for method_title, expected_stage in test_cases:
9090
with self.subTest(method_title=method_title, expected_stage=expected_stage):
9191
generator = generator_from_special_title(method_title)
9292
self.assertIsInstance(generator, PlaceNotationGenerator)
@@ -112,7 +112,7 @@ def test_stedman__odd_stages(self):
112112
("Stedman Cinques", 11),
113113
]
114114

115-
for (method_title, expected_stage) in test_cases:
115+
for method_title, expected_stage in test_cases:
116116
with self.subTest(method_title=method_title, expected_stage=expected_stage):
117117
generator = generator_from_special_title(method_title)
118118
self.assertIsInstance(generator, PlaceNotationGenerator)
@@ -149,7 +149,7 @@ def test_plain_hunt__all_stages(self):
149149
("Plain Hunt Maximus", 12),
150150
]
151151

152-
for (method_title, expected_stage) in test_cases:
152+
for method_title, expected_stage in test_cases:
153153
with self.subTest(method_title=method_title, expected_stage=expected_stage):
154154
generator = generator_from_special_title(method_title)
155155
self.assertIsInstance(generator, PlainHuntGenerator)

tests/test_parsing.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_peal_speed_parsing(self):
2727
(" 2 h 30 m ", 150),
2828
]
2929

30-
for (input_arg, expected_minutes) in test_cases:
30+
for input_arg, expected_minutes in test_cases:
3131
with self.subTest(input=input_arg, expected_minutes=expected_minutes):
3232
self.assertEqual(expected_minutes, parse_peal_speed(input_arg))
3333

@@ -47,7 +47,7 @@ def test_peal_speed_parsing_errors(self):
4747
("\nXX X ", "The minute value 'XX X' is not an integer."),
4848
]
4949

50-
for (input_arg, expected_message) in test_cases:
50+
for input_arg, expected_message in test_cases:
5151
with self.subTest(input=input_arg, expected_message=expected_message):
5252
with self.assertRaises(PealSpeedParseError) as e:
5353
parse_peal_speed(input_arg)
@@ -62,7 +62,7 @@ def test_call_parsing(self):
6262
("20: 70/ 14", {20: "70", 0: "14"}),
6363
]
6464

65-
for (input_arg, expected_call_dict) in test_cases:
65+
for input_arg, expected_call_dict in test_cases:
6666
with self.subTest(input=input_arg, expected_call_dict=expected_call_dict):
6767
self.assertEqual(CallDef(expected_call_dict), parse_call(input_arg))
6868

@@ -75,7 +75,7 @@ def test_call_parsing_errors(self):
7575
("::: /", "Call specification ':::' should contain at most one ':'."),
7676
]
7777

78-
for (input_arg, expected_message) in test_cases:
78+
for input_arg, expected_message in test_cases:
7979
with self.subTest(input=input_arg, expected_message=expected_message):
8080
with self.assertRaises(CallParseError) as e:
8181
parse_call(input_arg)
@@ -84,7 +84,7 @@ def test_call_parsing_errors(self):
8484
def test_place_notation_parsing(self):
8585
test_cases = [("5:5.1.5.1.5", (5, "5.1.5.1.5")), ("6:x16,12", (6, "x16,12"))]
8686

87-
for (input_arg, expected_tuple) in test_cases:
87+
for input_arg, expected_tuple in test_cases:
8888
with self.subTest(input=input_arg, expected_tuple=expected_tuple):
8989
self.assertEqual(expected_tuple, parse_place_notation(input_arg))
9090

@@ -95,7 +95,7 @@ def test_place_notation_parsing_errors(self):
9595
("6:z16x16x16,12", "Place notation is invalid"),
9696
]
9797

98-
for (input_arg, expected_message) in test_cases:
98+
for input_arg, expected_message in test_cases:
9999
with self.subTest(input=input_arg, expected_message=expected_message):
100100
with self.assertRaises(PlaceNotationError) as e:
101101
parse_place_notation(input_arg)
@@ -196,7 +196,7 @@ def test_url_conversion_errors(self):
196196
def test_parse_start_row(self):
197197
test_cases = [("654321", 6), ("1", 1)]
198198

199-
for (input_arg, expected_output) in test_cases:
199+
for input_arg, expected_output in test_cases:
200200
with self.subTest(input=input_arg, expected_output=expected_output):
201201
output = parse_start_row(input_arg)
202202
self.assertEqual(output, expected_output)
@@ -209,7 +209,7 @@ def test_parse_start_row_errors(self):
209209
("654326", "Start row contains bell 6 mutiple times"),
210210
]
211211

212-
for (input_arg, expected_message) in test_cases:
212+
for input_arg, expected_message in test_cases:
213213
with self.subTest(input=input_arg, expected_message=expected_message):
214214
with self.assertRaises(StartRowParseError) as e:
215215
parse_start_row(input_arg)

0 commit comments

Comments
 (0)