Skip to content

Commit bbb333b

Browse files
authored
Import ensure_drafts_file from src/draft_utils.py
Implement unique test drafts file generation
1 parent 0f99aaa commit bbb333b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import uuid
23
import json
34
import unittest
45
from unittest.mock import patch
@@ -25,7 +26,12 @@
2526
# ))
2627
# from main import app
2728

28-
TEST_DRAFTS_FILE = "test-drafts.json"
29+
# Generate a unique test drafts file name
30+
TEST_DRAFTS_FILE = f"test-drafts-{uuid.uuid4().hex[:6]}.json"
31+
32+
# Ensure DRAFTS_FILE path is resolved and the file exists, following XDG Base Directory Specification if necessary.
33+
TEST_DRAFTS_FILE = ensure_drafts_file(TEST_DRAFTS_FILE)
34+
os.remove(TEST_DRAFTS_FILE)
2935

3036
class TestThreadsCLI(unittest.TestCase):
3137
def setUp(self):

0 commit comments

Comments
 (0)