Permalink
Browse files

Use MSGPACK_PUREPYTHON envvar to test fallback module

  • Loading branch information...
1 parent 328369e commit cbabeebc95e9e42c0356e089b742588a4de75d56 @methane methane committed Jan 29, 2013
Showing with 9 additions and 5 deletions.
  1. +1 −1 .travis.yml
  2. +8 −4 msgpack/__init__.py
View
2 .travis.yml
@@ -12,4 +12,4 @@ install:
- cython --cplus msgpack/_packer.pyx
- cython --cplus msgpack/_unpacker.pyx
-script: "tox"
+script: "tox && MSGPACK_PUREPYTHON=x tox"
View
12 msgpack/__init__.py
@@ -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

0 comments on commit cbabeeb

Please sign in to comment.