Skip to content

Commit

Permalink
obtain fixture artifact path programmatically
Browse files Browse the repository at this point in the history
  • Loading branch information
prabodh1194 committed Sep 12, 2024
1 parent 01ef2fc commit 2d72224
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# python
.env
venv
.venv
**/.python-version
__pycache__

Expand Down
5 changes: 3 additions & 2 deletions python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

import os
import zipfile
from pathlib import Path

import pytest

from .table.table_path import get_table_path


def _extract_testing_table(zip_file_path, target_path) -> str:
with zipfile.ZipFile(zip_file_path, "r") as zip_ref:
Expand All @@ -36,5 +37,5 @@ def _extract_testing_table(zip_file_path, target_path) -> str:
def get_sample_table(request, tmp_path) -> str:
fixture_path = "tests/table"
table_name = request.param
zip_file_path = Path(fixture_path).joinpath(f"{table_name}.zip")
zip_file_path = get_table_path(table_name)
return _extract_testing_table(zip_file_path, tmp_path)
7 changes: 7 additions & 0 deletions python/tests/table/table_path.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os
from pathlib import Path


def get_table_path(table_name: str) -> Path:
absolute_cwd = os.path.abspath(os.path.dirname(__file__))
return Path(absolute_cwd).joinpath(f"{table_name}.zip")

0 comments on commit 2d72224

Please sign in to comment.