20 lines
454 B
Python
20 lines
454 B
Python
"""Shared unittest helpers."""
|
|||
|
|
|
||
|
|
import os
|
||
|
|
import sys
|
||
|
|
import tempfile
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
|
||
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||
|
|
if str(REPO_ROOT) not in sys.path:
|
||
|
|
sys.path.insert(0, str(REPO_ROOT))
|
||
|
|
|
||
|
|
|
||
|
|
class TempDirMixin:
|
||
|
|
def make_temp_dir(self):
|
||
|
|
return tempfile.TemporaryDirectory(prefix="cmshopee_test_", dir=Path(__file__).parent)
|
||
|
|
|
||
|
|
def assert_removed(self, path):
|
||
|
|
self.assertFalse(os.path.exists(path), path)
|