Skip to content

Commit 241c41e

Browse files
committed
V3 stable
documentacion gitactions
1 parent c5a656b commit 241c41e

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

test_adatavision.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import csv
99
from unittest.mock import patch, MagicMock
1010
from datetime import date, datetime
11+
from unittest import mock
1112

1213
def test_basic_imports():
1314
"""Test para verificar que todas las librerías básicas se importan correctamente"""
@@ -56,15 +57,18 @@ def resource_path(relative_path):
5657
assert isinstance(result, str)
5758
assert "test_file.txt" in result
5859

60+
def resource_path(relative_path):
61+
try:
62+
base_path = sys._MEIPASS
63+
except AttributeError:
64+
base_path = os.path.abspath(".")
65+
return os.path.join(base_path, relative_path)
66+
5967
def test_resource_path_with_meipass():
6068
"""Test para resource_path cuando existe _MEIPASS (PyInstaller)"""
61-
def resource_path(relative_path):
62-
try:
63-
base_path = sys._MEIPASS
64-
except AttributeError:
65-
base_path = os.path.abspath(".")
66-
return os.path.join(base_path, relative_path)
67-
69+
with mock.patch.object(sys, '_MEIPASS', '/tmp/fake_meipass', create=True):
70+
resultado = resource_path('archivo.txt')
71+
assert resultado == os.path.join('/tmp/fake_meipass', 'archivo.txt')
6872
# Simulamos que _MEIPASS existe
6973
with patch.object(sys, '_MEIPASS', '/tmp/pyinstaller'):
7074
result = resource_path("icon.png")

0 commit comments

Comments
 (0)