mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-19 20:03:16 +00:00
Use MSGPACK_PUREPYTHON envvar to test fallback module
This commit is contained in:
parent
328369e52e
commit
cbabeebc95
2 changed files with 9 additions and 5 deletions
|
@ -12,4 +12,4 @@ install:
|
|||
- cython --cplus msgpack/_packer.pyx
|
||||
- cython --cplus msgpack/_unpacker.pyx
|
||||
|
||||
script: "tox"
|
||||
script: "tox && MSGPACK_PUREPYTHON=x tox"
|
||||
|
|
|
@ -2,11 +2,15 @@
|
|||
from msgpack._version import version
|
||||
from msgpack.exceptions import *
|
||||
|
||||
try:
|
||||
from msgpack._packer import pack, packb, Packer
|
||||
from msgpack._unpacker import unpack, unpackb, Unpacker
|
||||
except ImportError:
|
||||
import os
|
||||
if os.environ.get('MSGPACK_PUREPYTHON'):
|
||||
from msgpack.fallback import pack, packb, Packer, unpack, unpackb, Unpacker
|
||||
else:
|
||||
try:
|
||||
from msgpack._packer import pack, packb, Packer
|
||||
from msgpack._unpacker import unpack, unpackb, Unpacker
|
||||
except ImportError:
|
||||
from msgpack.fallback import pack, packb, Packer, unpack, unpackb, Unpacker
|
||||
|
||||
# alias for compatibility to simplejson/marshal/pickle.
|
||||
load = unpack
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue