Improve test coverage wrt protocol versions; other fixes/improvements
Improvements to the test suite: * List release version names and numbers in minecraft/__init__.py. * Make some tests, which previously ran for *all* protocol versions, run only for release protocol versions (to improve test performance). * Make some tests, which previously ran only for the latest protocol version, run for all release protocol versions (to improve coverage). * Print each protocol version being tested to the debug log, to help identify sources of errors. * Use the `nose-timer' plugin to show the run time of each test. Fix errors revealed by increased test coverage: * Fix: SoundEffectPacket.Pitch is not serialised correctly for early protocol versions. * Fix: handleExceptionTest finishes later than necessary because the test overrode an exception handler used internally by `_FakeServerTest', causing the server thread to time out after 4s. * Add support for multiple exception handlers in `Connection' (required for the above). Improvements to data descriptors: * Make syntax of property declarations more consistent/Pythonic. * Factor the definition of several aliasing properties into the utility methods `attribute_alias' and `multi_attribute_alias', which construct suitable data descriptors. * Define and use the named tuple `Direction' for (pitch, yaw) values.
This commit is contained in:
1 parent
6ef868bc5b
commit
7b1567c352
12 files changed
+318
-157
No files matched your search
@@ -3,8 +3,11 @@ A modern, Python3-compatible, well-documented library for communicating
|
||||
with a MineCraft server.
|
||||
"""
|
||||
|
||||
# The version number of the most recent pyCraft release.
|
||||
__version__ = "0.5.0"
|
||||
|
||||
# A dict mapping the name of each Minecraft version supported by pyCraft to
|
||||
# the corresponding protocol version number.
|
||||
SUPPORTED_MINECRAFT_VERSIONS = {
|
||||
'1.8': 47,
|
||||
'1.8.1': 47,
|
||||
@@ -175,5 +178,18 @@ SUPPORTED_MINECRAFT_VERSIONS = {
|
||||
'1.14.1': 480,
|
||||
}
|
||||
|
||||
# Those Minecraft versions supported by pyCraft which are "release" versions,
|
||||
# i.e. not development snapshots or pre-release versions.
|
||||
RELEASE_MINECRAFT_VERSIONS = {
|
||||
name: protocol for (name, protocol) in SUPPORTED_MINECRAFT_VERSIONS.items()
|
||||
if __import__('re').match(r'\d+(\.\d+)+$', name)}
|
||||
|
||||
# The protocol versions of SUPPORTED_MINECRAFT_VERSIONS, without duplicates,
|
||||
# in ascending numerical (and hence chronological) order.
|
||||
SUPPORTED_PROTOCOL_VERSIONS = \
|
||||
sorted(set(SUPPORTED_MINECRAFT_VERSIONS.values()))
|
||||
|
||||
# The protocol versions of RELEASE_MINECRAFT_VERSIONS, without duplicates,
|
||||
# in ascending numerical (and hence chronological) order.
|
||||
RELEASE_PROTOCOL_VERSIONS = \
|
||||
sorted(set(RELEASE_MINECRAFT_VERSIONS.values()))
|
||||
Reference in new issue
Block a user