-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert unpythonic.net.test tests to unpythonic.test.fixtures
Doesn't work yet due to a MacroPy issue with `bytes` literals, which are needed by these tests. See: azazel75/macropy#26
- Loading branch information
1 parent
f66d553
commit 488b09b
Showing
2 changed files
with
107 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
# -*- coding: utf-8; -*- | ||
|
||
from ...syntax import macros, test # noqa: F401 | ||
from ...test.fixtures import testset | ||
|
||
from .fixtures import nettest | ||
|
||
from ..util import recvall, netstringify | ||
|
||
def runtests(): | ||
assert netstringify(b"hello world") == b"11:hello world," | ||
|
||
server = lambda sock: recvall(1024, sock) | ||
client = lambda sock: [sock.sendall(b"x" * 512), sock.sendall(b"x" * 512)] | ||
assert len(nettest(server, client)) == 1024 | ||
# TODO: As of MacroPy 1.1.0b2, this test module crashes at macro expansion time | ||
# TODO: due to a MacroPy bug involving `bytes` literals. | ||
# TODO: https://github.com/azazel75/macropy/issues/26 | ||
with testset("unpythonic.net.util"): | ||
test[netstringify(b"hello world") == b"11:hello world,"] | ||
|
||
print("All tests PASSED") | ||
server = lambda sock: recvall(1024, sock) | ||
client = lambda sock: [sock.sendall(b"x" * 512), sock.sendall(b"x" * 512)] | ||
test[len(nettest(server, client)) == 1024] | ||
|
||
if __name__ == '__main__': | ||
runtests() |