Skip to content

Commit

Permalink
add data dir for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gcroci2 committed Jul 29, 2024
1 parent dde53e4 commit b9c851f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from pathlib import Path


DATA_DIR = Path(__file__).resolve().parent / "data"
11 changes: 5 additions & 6 deletions tests/test_callbacks.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import os
from pathlib import Path
from dash_uploader import UploadStatus
from app.app import disable_tabs
from app.app import upload_data
from . import DATA_DIR


MOCK_FILE_PATH = os.path.join(os.path.dirname(__file__), "data/mock_obj_data.pkl")
MOCK_FILE_PATH = Path(DATA_DIR, "mock_obj_data.pkl")


def test_upload_data():
Expand All @@ -15,11 +17,8 @@ def test_upload_data():
upload_string, path_string = upload_data(status)

# Check the result
assert (
upload_string
== f"Successfully uploaded file `{os.path.basename(MOCK_FILE_PATH)}` of size 5.39 MB."
)
assert path_string == MOCK_FILE_PATH
assert upload_string == f"Successfully uploaded: {os.path.basename(MOCK_FILE_PATH)} [5.39 MB]"
assert path_string == str(MOCK_FILE_PATH)


def test_disable_tabs():
Expand Down

0 comments on commit b9c851f

Please sign in to comment.