Update environment variable loading to support process environment and improve error handling
All checks were successful
Publish Twitch Archive Container / publish (push) Successful in 1m24s

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
MaddoScientisto 2026-04-25 16:19:01 +02:00
commit cd3e37ff59
4 changed files with 34 additions and 12 deletions

View file

@ -741,7 +741,6 @@ class TestMultiStreamerCleanupRegression(unittest.TestCase):
}
}
}
stream_info = {
'title': 'Test',
'createdAt': '2026-04-25T09:14:01Z'
@ -753,6 +752,21 @@ class TestMultiStreamerCleanupRegression(unittest.TestCase):
archiver.file_manager.delete_local_files.assert_not_called()
class TestEnvironmentLoadingRegression(unittest.TestCase):
"""Regression tests for process environment startup in containers."""
def setUp(self):
self.module = load_twitch_archive_module()
@patch.dict(os.environ, {'CLIENT-ID': 'portainer-client', 'CLIENT-SECRET': 'portainer-secret'}, clear=True)
@patch('dotenv.main.find_dotenv', return_value='')
@patch('dotenv.main.load_dotenv', return_value=False)
def test_load_environment_variables_accepts_process_environment_without_dotenv(self, _mock_load_dotenv, _mock_find_dotenv):
archive = self.module.TwitchArchive.__new__(self.module.TwitchArchive)
self.module.TwitchArchive._load_environment_variables(archive)
if __name__ == '__main__':
# Run tests with verbose output
print("="*70)