mirror of https://gitlab.com/bashrc2/epicyon
Create separate directory for unit test
parent
eb205f9222
commit
b22cf1c1a7
|
@ -369,6 +369,8 @@ def store_book_events(base_dir: str,
|
|||
print('DEBUG: no book event')
|
||||
return False
|
||||
reading_path = base_dir + '/accounts/reading'
|
||||
if not os.path.isdir(base_dir + '/accounts'):
|
||||
os.mkdir(base_dir + '/accounts')
|
||||
if not os.path.isdir(reading_path):
|
||||
os.mkdir(reading_path)
|
||||
books_path = reading_path + '/books'
|
||||
|
|
9
tests.py
9
tests.py
|
@ -8237,9 +8237,11 @@ def _test_book_link(base_dir: str):
|
|||
max_recent_books = 1000
|
||||
max_cached_readers = 10
|
||||
|
||||
base_dir += '/.testbookevents'
|
||||
if os.path.isdir(base_dir):
|
||||
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
|
||||
os.mkdir(base_dir)
|
||||
reading_dir = base_dir + '/accounts/reading'
|
||||
if os.path.isdir(reading_dir):
|
||||
shutil.rmtree(reading_dir, ignore_errors=False, onerror=None)
|
||||
|
||||
content = 'Not a link'
|
||||
result = get_book_link_from_content(content)
|
||||
|
@ -8422,6 +8424,9 @@ def _test_book_link(base_dir: str):
|
|||
assert books_cache['reader_list'][2] == actor
|
||||
assert books_cache['readers'].get(actor)
|
||||
|
||||
if os.path.isdir(base_dir):
|
||||
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
|
||||
|
||||
|
||||
def run_all_tests():
|
||||
base_dir = os.getcwd()
|
||||
|
|
Loading…
Reference in New Issue