test: fix `setup.py test` failing due to import error

because of relative import the script has to be run as:
    python -m test.run_benchmarks
This commit is contained in:
Jędrzej Boczar 2020-01-30 14:11:52 +01:00
parent bb4f6106ee
commit 096de78c63
1 changed files with 4 additions and 2 deletions

View File

@ -3,12 +3,13 @@
# This file is Copyright (c) 2020 Jędrzej Boczar <jboczar@antmicro.com> # This file is Copyright (c) 2020 Jędrzej Boczar <jboczar@antmicro.com>
# License: BSD # License: BSD
import os
import re import re
import subprocess import subprocess
from litedram.common import Settings from litedram.common import Settings
from benchmark import LiteDRAMBenchmarkSoC from .benchmark import LiteDRAMBenchmarkSoC
# constructs python regex named group # constructs python regex named group
@ -26,7 +27,8 @@ def human_readable(value):
def run_benchmark(args): def run_benchmark(args):
command = ['python3', 'benchmark.py', *args] benchmark_script = os.path.join(os.path.dirname(__file__), 'benchmark.py')
command = ['python3', benchmark_script, *args]
proc = subprocess.run(command, capture_output=True, text=True, check=True) proc = subprocess.run(command, capture_output=True, text=True, check=True)
return proc.stdout return proc.stdout