Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster-test/dagster_test/fixtures/utils.py
- This file was added.
import os | |||||
import pytest | |||||
import requests | |||||
from urllib3.util.retry import Retry | |||||
BUILDKITE = os.environ.get("BUILDKITE") is not None | |||||
@pytest.fixture | |||||
def retrying_requests(): | |||||
session = requests.Session() | |||||
session.mount( | |||||
"http://", requests.adapters.HTTPAdapter(max_retries=Retry(total=5, backoff_factor=1)) | |||||
) | |||||
yield session | |||||
@pytest.fixture | |||||
def test_directory(request): | |||||
yield os.path.dirname(request.fspath) | |||||
johann: oh nice, this is a default temp dir? | |||||
Done Inline ActionsIt's actually the directory where the test was collected from. So if you have: test_foo/ __init__.py test_foo.py test_bar/ __init__.py test_bar.py docker-compose.yml and you run pytest, then your cwd will obviously be wherever pytest is invoked from. request.fspath will be the path to the file where the test comes from. And test_directory will be the path to the directory where that file lives. So for any test in test_bar.py, test_directory will return test_foo/test_bar which makes it easier for us to then identify test_foo/test_bar/docker-compose.yml jordansanders: It's actually the directory where the test was collected from.
So if you have:
```
test_foo/… |
oh nice, this is a default temp dir?