From 6e8ba969041ba44accebd5a9301a210abba6975e Mon Sep 17 00:00:00 2001 From: Chris Fulljames Date: Mon, 20 Jan 2025 22:38:22 -0500 Subject: [PATCH] Fix file paths --- test/test_offline.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/test_offline.py b/test/test_offline.py index 408eb17..6af9202 100644 --- a/test/test_offline.py +++ b/test/test_offline.py @@ -1,6 +1,8 @@ import html import json +import os import re +import sys import tempfile from pathlib import Path from unittest.mock import patch @@ -9,6 +11,8 @@ import bcrypt import pytest from flask import session +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) + import main @pytest.fixture @@ -231,7 +235,7 @@ def test_upload_song_collab_too_long(client): def test_upload_song_invalid_mp3(client): _create_user(client, "user", "password", login=True) - song_file = open("test.py", "rb") + song_file = open(__file__, "rb") _test_upload_song(client, b"Invalid mp3 file", error=True, song=song_file) ################################################################################ @@ -294,7 +298,7 @@ def test_update_song_collab_too_long(client): def test_update_song_invalid_mp3(client): _create_user_and_song(client) - song_file = open("test.py", "rb") + song_file = open(__file__, "rb") _test_upload_song(client, b"Invalid mp3 file", error=True, songid=1, song=song_file) def test_update_song_invalid_song(client): -- 2.39.5