1
0
Fork 0
mirror of https://github.com/ultrajson/ultrajson.git synced 2024-05-05 03:36:09 +02:00

Merge pull request #534 from Erotemic/fix-ci-benchmark

Benchmark CI fixes
This commit is contained in:
Hugo van Kemenade 2022-04-27 13:06:04 +03:00 committed by GitHub
commit ebdb150991
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -4,6 +4,10 @@ on:
push:
branches:
- main
pull_request:
paths:
- ".github/workflows/benchmark.yml"
- "tests/benchmark.py"
jobs:
build:

View File

@ -447,22 +447,23 @@ def main():
"--disable",
nargs="+",
choices=known_libraries,
help=("Remove specified libraries from the benchmarks"),
help="Remove specified libraries from the benchmarks",
default=[],
)
parser.add_argument(
"--factor",
type=float,
default=1.0,
help=("Specify as a fraction speed up benchmarks for development / testing"),
help="Specify as a fraction speed up benchmarks for development / testing",
)
args = parser.parse_args()
disabled_libraires = set(args.disable)
disabled_libraries = set(args.disable)
enabled_libraries = {}
for libname in known_libraries:
if libname not in disabled_libraires:
if libname not in disabled_libraries:
try:
module = importlib.import_module(libname)
except ImportError:
@ -470,7 +471,7 @@ def main():
else:
enabled_libraries[libname] = module
# Ensure the modules are avilable in a the global scope
# Ensure the modules are available in the global scope
for libname, module in enabled_libraries.items():
print(f"Enabled {libname} benchmarks")
globals()[libname] = module