Skip to content

Commit

Permalink
Fix usage of setup.py test
Browse files Browse the repository at this point in the history
  • Loading branch information
ideoforms committed Dec 3, 2023
1 parent 75afa43 commit 81a43ae
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,25 @@
#------------------------------------------------------------------------
def distutils_dir_name(dir_name):
"""Returns the name of a distutils build directory"""
f = "{dirname}.{platform}-{version[0]}.{version[1]}"
f = "{dirname}.{platform}-cpython-{version[0]}{version[1]}"
return f.format(dirname=dir_name,
platform=sysconfig.get_platform(),
version=sys.version_info)

#------------------------------------------------------------------------
# Ensure that build dir exists and prioritise this library in sys.path
#------------------------------------------------------------------------
build_dir = os.path.join("build", distutils_dir_name("lib"))
sys.path.insert(0, build_dir)
if not os.path.exists(build_dir):
raise RuntimeError("Couldn't find .so build dir: %s" % build_dir)
if build_dir not in sys.path:
sys.path.insert(0, build_dir)

#------------------------------------------------------------------------
# Ensure that placeholder package from auxiliary isn't imported
#------------------------------------------------------------------------
sys.path = list(filter(lambda path: "auxiliary/libs" not in path, sys.path))

import signalflow

def process_tree(node, buffer=None, num_frames=signalflow.SIGNALFLOW_DEFAULT_BLOCK_SIZE):
Expand Down Expand Up @@ -76,4 +88,4 @@ def graph():
# test fails (which can lead dangling references). Not doing this means that
# all subsequent tests will fail with "AudioGraph has already been created".
#--------------------------------------------------------------------------------
graph.destroy()
graph.destroy()

0 comments on commit 81a43ae

Please sign in to comment.