Add PyInstaller compatibility support (fixes #2613)

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-04-15 20:56:31 +00:00
parent 409892d65f
commit 7537dc45ef
3 changed files with 39 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import unittest
from unittest.mock import patch
import sys
from crewai.utilities.pyinstaller_compat import is_bundled, get_bundle_dir
class TestPyInstallerCompat(unittest.TestCase):
def test_is_bundled_normal(self):
self.assertFalse(is_bundled())
@patch.object(sys, 'frozen', True, create=True)
@patch.object(sys, '_MEIPASS', '/path/to/bundle', create=True)
def test_is_bundled_pyinstaller(self):
self.assertTrue(is_bundled())
self.assertEqual(get_bundle_dir(), '/path/to/bundle')