mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
* tests: use remote fixtures * tests: use remote fixtures for data cloud tests * tests: treat remotes as tmp dirs
40 lines
862 B
Python
40 lines
862 B
Python
import os
|
|
import uuid
|
|
|
|
import pytest
|
|
|
|
from dvc.utils import env2bool
|
|
|
|
from .base import Base
|
|
|
|
|
|
class Azure(Base):
|
|
@staticmethod
|
|
def should_test():
|
|
do_test = env2bool("DVC_TEST_AZURE", undefined=None)
|
|
if do_test is not None:
|
|
return do_test
|
|
|
|
return os.getenv("AZURE_STORAGE_CONTAINER_NAME") and os.getenv(
|
|
"AZURE_STORAGE_CONNECTION_STRING"
|
|
)
|
|
|
|
@staticmethod
|
|
def get_url():
|
|
container_name = os.getenv("AZURE_STORAGE_CONTAINER_NAME")
|
|
assert container_name is not None
|
|
return "azure://{}/{}".format(container_name, str(uuid.uuid4()))
|
|
|
|
|
|
@pytest.fixture
|
|
def azure():
|
|
if not Azure.should_test():
|
|
pytest.skip("no azure running")
|
|
yield Azure()
|
|
|
|
|
|
@pytest.fixture
|
|
def azure_remote(tmp_dir, dvc, azure):
|
|
tmp_dir.add_remote(config=azure.config)
|
|
yield azure
|