Skip to content

Commit

Permalink
Updated Pipeline To Support Multi-OS & Added Support for PyPI Release
Browse files Browse the repository at this point in the history
  • Loading branch information
coldsofttech committed Apr 13, 2024
1 parent 87b6835 commit 034c8f8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
9 changes: 6 additions & 3 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
import platform
import sys
import threading
import tkinter as tk
Expand Down Expand Up @@ -459,9 +460,11 @@ def _open_license(self, event) -> None:


def main():
if os.environ.get('DISPLAY', '') == '':
print('No display found. Using: 0.0')
os.environ.__setitem__('DISPLAY', ':0.0')
if platform.system().lower() == 'linux':
if platform.dist()[0].lower() == 'ubuntu':
if os.environ.get('DISPLAY', '') == '':
print('No display found. Using: 0.0')
os.environ.__setitem__('DISPLAY', ':0.0')

root = tk.Tk()
M3U8DownloaderUI(root)
Expand Down
9 changes: 6 additions & 3 deletions tests/unit/test_aboutui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
import tkinter as tk
import unittest
from unittest.mock import patch
Expand All @@ -12,9 +13,11 @@ class TestAboutUI(unittest.TestCase):
"""Unit test cases for AboutUI"""

def setUp(self):
if os.environ.get('DISPLAY', '') == '':
print('No display found. Using: 0.0')
os.environ.__setitem__('DISPLAY', ':0.0')
if platform.system().lower() == 'linux':
if platform.dist()[0].lower() == 'ubuntu':
if os.environ.get('DISPLAY', '') == '':
print('No display found. Using: 0.0')
os.environ.__setitem__('DISPLAY', ':0.0')

self.root = tk.Tk()

Expand Down
9 changes: 6 additions & 3 deletions tests/unit/test_downloadthread.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
import platform
import tkinter as tk
import unittest

Expand All @@ -12,9 +13,11 @@ class TestDownloadThread(unittest.TestCase):
"""Unit test cases for DownloadThread class."""

def setUp(self):
if os.environ.get('DISPLAY', '') == '':
print('No display found. Using: 0.0')
os.environ.__setitem__('DISPLAY', ':0.0')
if platform.system().lower() == 'linux':
if platform.dist()[0].lower() == 'ubuntu':
if os.environ.get('DISPLAY', '') == '':
print('No display found. Using: 0.0')
os.environ.__setitem__('DISPLAY', ':0.0')

self.input_url = 'https://raw.githubusercontent.com/coldsofttech/pym3u8downloader/main/tests/files/index.m3u8'
self.output_file = 'video.mp4'
Expand Down
9 changes: 6 additions & 3 deletions tests/unit/test_m3u8downloaderui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
import tkinter as tk
import unittest
from unittest.mock import patch, MagicMock
Expand All @@ -12,9 +13,11 @@ class TestM3U8DownloaderUI(unittest.TestCase):
"""Unit test cases for M3U8DownloaderUI"""

def setUp(self):
if os.environ.get('DISPLAY', '') == '':
print('No display found. Using: 0.0')
os.environ.__setitem__('DISPLAY', ':0.0')
if platform.system().lower() == 'linux':
if platform.dist()[0].lower() == 'ubuntu':
if os.environ.get('DISPLAY', '') == '':
print('No display found. Using: 0.0')
os.environ.__setitem__('DISPLAY', ':0.0')

self.root = tk.Tk()
self.source = M3U8DownloaderUI(self.root)
Expand Down
9 changes: 6 additions & 3 deletions tests/unit/test_stdoutredirector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
import tkinter as tk
import unittest

Expand All @@ -11,9 +12,11 @@ class TestStdoutRedirector(unittest.TestCase):
"""Unit test cases for StdoutRedirector"""

def setUp(self):
if os.environ.get('DISPLAY', '') == '':
print('No display found. Using: 0.0')
os.environ.__setitem__('DISPLAY', ':0.0')
if platform.system().lower() == 'linux':
if platform.dist()[0].lower() == 'ubuntu':
if os.environ.get('DISPLAY', '') == '':
print('No display found. Using: 0.0')
os.environ.__setitem__('DISPLAY', ':0.0')

self.root = tk.Tk()
self.text_variable = tk.StringVar()
Expand Down

0 comments on commit 034c8f8

Please sign in to comment.