Skip to content

Commit

Permalink
Refactor unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghua committed Aug 15, 2024
1 parent 29b7761 commit c9eaa77
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tosfs/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
# limitations under the License.

import os

import pytest
from tos import EnvCredentialsProvider

from tosfs.core import TosFileSystem


@pytest.fixture(scope="module")
def tosfs_env_prepare():
if "TOS_ACCESS_KEY" not in os.environ:
Expand All @@ -28,11 +31,12 @@ def tosfs_env_prepare():
"Can not find TOS_SECRET_KEY in environment variables."
)


@pytest.fixture(scope="module")
def tosfs(tosfs_env_prepare):
tosfs = TosFileSystem(
endpoint_url=os.environ.get("TOS_ENDPOINT"),
region=os.environ.get("TOS_REGION"),
credentials_provider=EnvCredentialsProvider(),
)
yield tosfs
yield tosfs

0 comments on commit c9eaa77

Please sign in to comment.