Commit Graph

22 Commits

Author SHA1 Message Date
joodicator
7b1567c352 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.
2019-05-14 18:41:58 +02:00
joodicator
41ea36c642 Add test coverage for @listener. 2019-05-13 19:04:35 +02:00
joodicator
612fa8e324 Add support for Minecraft 18w43a to 1.14 (protocols 441 to 477)
This commit introduces two backward-incompatible changes which may break
existing code:

(1) `networking.packets.clientbound.play.SpawnObjectPacket.EntityType'
is no longer accessible as an attribute of the the `SpawnObjectPacket'
class: the values now depend on a `ConnectionContext`, and must be
accessed through an instance, or using `SpawnObjectPacket.field_enum'.
See the text of the `AttributeError` raised from the descriptor for
`SpawnObjectPacket.EntityType` for the full details.

(2) For some subclasses of `networking.types.Type', it is necessary to
call the methods `read_with_context' and `send_with_context' instead of
`read' and `send', supplying a `ConnectionContext' for those data types
- currently only `Position` - whose layout depends on it.
2019-05-11 08:43:51 +02:00
joo
48e1003f42 Fix issue #109 and add regression test. 2018-10-12 17:07:04 +01:00
joo
adc8d15ddc Add support for Minecraft 1.13 and 1.13-pre3 to pre10 (protocols 385 to 393).
Add clientbound.login.PluginRequestPacket and serverbound.login.PluginResponsePacket.
2018-07-19 09:50:13 +01:00
joo
d36a4170ed Add tests for various Connection edge cases. 2018-05-29 01:14:46 +01:00
joo
92f2eff681 Add several tests for the Connection class. 2018-05-27 07:40:13 +01:00
joo
3269a022a8 Add KeepAlivePacket test to ConnectTest and derived tests. 2017-08-22 18:16:07 +01:00
joo
b79e7b5f28 Add tests for early and outgoing packet listeners. 2017-08-22 17:50:16 +01:00
joo
9497aae8fa Make FakeServer class more reusable, and extract it into its own module. 2017-08-22 14:22:12 +01:00
joo
593c98f168 Add support for early and outgoing packet listeners. 2017-08-21 21:06:28 +01:00
joo
46e058dd08 Update all tests, docs and code to use new packet names. 2017-08-09 20:53:54 +01:00
joo
cf464d2da2 Add compression tests to test_connection. 2017-08-03 13:04:47 +01:00
Ammar Askar
ca4fd6680e
Connect to localhost instead of the socket's binding address.
The bound address is 0.0.0.0 which usually implies all
available interfaces, which makes sense when listening
for something. However, when connecting to an address,
a specific address needs to be targeted. Hopefully, any
properly configured computer should have `localhost`
pointing to its loopback interface. Fixes #64
2017-07-16 00:19:30 -07:00
joo
bf17f99083 Change version negotiator to use a status query. 2016-11-22 14:47:42 +00:00
joo
d72f05c8b0 Show exceptions by default and add `handle_exception' parameter to Connection. 2016-11-20 06:04:22 +00:00
joo
115693f8c3 Implement full Server List Ping capability with test. 2016-11-20 06:04:22 +00:00
joo
bb1de5ca21 test_connection: fix timing issues caused by resource leaks. 2016-09-01 23:32:51 +01:00
joo
abd2ee774c Add thread timeout detection to test_connection. 2016-08-22 18:20:16 +01:00
joo
9af39f186a Make test_connection more deterministic. 2016-08-22 17:46:53 +01:00
joo
ce63626bb1 Add 4 tests in 'test_connection.py' and fix related bugs. 2016-06-18 18:22:18 +01:00
Ammar Askar
5d56162300 Quick little base test for connection 2015-04-03 22:04:45 +05:00