diff options
author | drebs <drebs@leap.se> | 2017-04-04 12:18:25 +0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2017-04-04 18:34:45 +0200 |
commit | 218273f4284ecf2d80def30ae74d92bc99b974b7 (patch) | |
tree | c889aafb4b847faa3a7dc8165cd6ee9d07e44ebc /testing/tests | |
parent | 414ecfbb95b067d8f72400af4da9ed686742efc3 (diff) |
[feat] add the host hostname to benchmark machine info
Diffstat (limited to 'testing/tests')
-rw-r--r-- | testing/tests/benchmarks/conftest.py | 2 | ||||
-rw-r--r-- | testing/tests/conftest.py | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/testing/tests/benchmarks/conftest.py b/testing/tests/benchmarks/conftest.py index 1b99d96e..bec5d7ab 100644 --- a/testing/tests/benchmarks/conftest.py +++ b/testing/tests/benchmarks/conftest.py @@ -1,6 +1,6 @@ +import base64 import pytest import random -import base64 from twisted.internet import threads, reactor diff --git a/testing/tests/conftest.py b/testing/tests/conftest.py index 589cb7de..2459307a 100644 --- a/testing/tests/conftest.py +++ b/testing/tests/conftest.py @@ -3,6 +3,8 @@ import os import pytest import requests import signal +import socket +import sys import time from hashlib import sha512 @@ -215,3 +217,21 @@ def soledad_client(tmpdir, soledad_server, remote_db, soledad_dbs, request): request.addfinalizer(soledad_client.close) return soledad_client return create + + +# +# pytest-benchmark customizations +# + +# avoid hooking if this is not a benchmarking environment +if 'pytest_benchmark' in sys.modules: + + def pytest_benchmark_update_machine_info(config, machine_info): + """ + Add the host's hostname information to machine_info. + + Get the value from the HOST_HOSTNAME environment variable if it is set, + or from the actual system's hostname otherwise. + """ + hostname = os.environ.get('HOST_HOSTNAME', socket.gethostname()) + machine_info['host'] = hostname |