Skip to content

Commit

Permalink
Enforce pytype and black checks during release.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkjt2000 committed Jul 5, 2021
1 parent 1c083a6 commit b1ed3bc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mcstatus/querier.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, connection):
@staticmethod
def _generate_session_id():
# minecraft only supports lower 4 bits
return random.randint(0, 2**31) & 0x0F0F0F0F
return random.randint(0, 2 ** 31) & 0x0F0F0F0F

def _create_packet(self):
packet = Connection()
Expand Down
2 changes: 2 additions & 0 deletions mcstatus/tests/protocol/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@


class TestConnection:
connection: Connection

def setup_method(self):
self.connection = Connection()

Expand Down
2 changes: 1 addition & 1 deletion mcstatus/tests/test_session_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ def session_id():

conn_bytes = self.querier.connection.flush()
assert conn_bytes[:3] == bytearray.fromhex("FEFD09")
assert conn_bytes[3:] == session_id().to_bytes(4, byteorder='big')
assert conn_bytes[3:] == session_id().to_bytes(4, byteorder="big")
assert self.querier.challenge == 570350778
2 changes: 2 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
-r requirements.txt
black
coverage
mock>=3.0.5
pytest
pytest-asyncio
pytest-cov
pytype
twine
12 changes: 11 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{36,37,38,39}
py{36,37,38,39},coverage,check

[testenv]
extras =
Expand All @@ -11,6 +11,11 @@ setenv =
commands =
pytest {posargs}

[testenv:check]
commands =
black --check -l 127 ./mcstatus
pytype ./mcstatus

[testenv:coverage]
depends =
py{36,37,38,39}
Expand All @@ -19,3 +24,8 @@ setenv =
commands =
coverage combine
coverage report --show-missing --fail-under=80

[testenv:format]
depends = py39
commands =
black -l 127 ./mcstatus

0 comments on commit b1ed3bc

Please sign in to comment.