Use distutils to generate path to pylibmc in tests.
This commit is contained in:
parent
aff42d767b
commit
8a1e5c752d
17
tests.py
17
tests.py
@ -196,18 +196,15 @@ Python-wrapped behaviors dict
|
|||||||
# Used to test pickling.
|
# Used to test pickling.
|
||||||
class Foo(object): pass
|
class Foo(object): pass
|
||||||
|
|
||||||
# Fix up sys.path so as to include the build/lib.*/ directory.
|
# Fix up sys.path so as to include the correct build/lib.*/ directory.
|
||||||
import sys
|
import sys
|
||||||
import os
|
from distutils.dist import Distribution
|
||||||
from glob import glob
|
from distutils.command.build import build
|
||||||
|
|
||||||
dist_dir = os.path.dirname(__file__)
|
build_cmd = build(Distribution({"ext_modules": True}))
|
||||||
for build_dir in glob(os.path.join(dist_dir, "build", "lib.*")):
|
build_cmd.finalize_options()
|
||||||
sys.path.insert(0, build_dir)
|
lib_dirn = build_cmd.build_lib
|
||||||
break
|
sys.path.insert(0, lib_dirn)
|
||||||
else:
|
|
||||||
print >>sys.stderr, "Using system-wide installation of pylibmc!"
|
|
||||||
print >>sys.stderr, "==========================================\n"
|
|
||||||
|
|
||||||
import pylibmc, _pylibmc
|
import pylibmc, _pylibmc
|
||||||
import socket
|
import socket
|
||||||
|
Reference in New Issue
Block a user