Skip to content

Commit

Permalink
[ci] Override Request in pytests (#11974)
Browse files Browse the repository at this point in the history
This follows on #11839 to apply it outside of docs and to tests running under pytest instead

Co-authored-by: driazati <driazati@users.noreply.github.com>
  • Loading branch information
driazati and driazati authored Jul 14, 2022
1 parent b9fa576 commit 09b607e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
# under the License.
import hashlib
import pytest
import sys
import os
from collections import OrderedDict

from pathlib import Path

pytest_plugins = ["tvm.testing.plugin"]
IS_IN_CI = os.getenv("CI", "") == "true"
REPO_ROOT = Path(__file__).resolve().parent


# These are long running tests (manually curated and extracted from CI logs)
Expand Down Expand Up @@ -96,3 +100,12 @@ def pytest_collection_modifyitems(config, items):
reason=f"Test running on shard {item_shard_index} of {num_shards}",
)
)


def pytest_sessionstart():
if IS_IN_CI:
hook_script_dir = REPO_ROOT / "tests" / "scripts" / "request_hook"
sys.path.append(str(hook_script_dir))
import request_hook # pylint: disable=import-outside-toplevel

request_hook.init()

0 comments on commit 09b607e

Please sign in to comment.