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 034c8f8 commit a692ace
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 40 deletions.
12 changes: 7 additions & 5 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,15 @@ def _open_license(self, event) -> None:
webbrowser.open(self.license_link)


def main():
def display_settings():
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')
if os.environ.get('DISPLAY', '') == '':
print('No display found. Using: 0.0')
os.environ.__setitem__('DISPLAY', ':0.0')


def main():
display_settings()
root = tk.Tk()
M3U8DownloaderUI(root)
root.mainloop()
Expand Down
11 changes: 2 additions & 9 deletions tests/unit/test_aboutui.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
import os
import platform
import tkinter as tk
import unittest
from unittest.mock import patch

import pytest

from src import AboutUI
from src import AboutUI, display_settings


class TestAboutUI(unittest.TestCase):
"""Unit test cases for AboutUI"""

def setUp(self):
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')

display_settings()
self.root = tk.Tk()

def tearDown(self):
Expand Down
10 changes: 2 additions & 8 deletions tests/unit/test_downloadthread.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import json
import os
import platform
import tkinter as tk
import unittest

import pytest

from src import M3U8DownloaderUI, DownloadThread
from src import M3U8DownloaderUI, DownloadThread, display_settings


class TestDownloadThread(unittest.TestCase):
"""Unit test cases for DownloadThread class."""

def setUp(self):
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')

display_settings()
self.input_url = 'https://raw.githubusercontent.com/coldsofttech/pym3u8downloader/main/tests/files/index.m3u8'
self.output_file = 'video.mp4'
self.root = tk.Tk()
Expand Down
11 changes: 2 additions & 9 deletions tests/unit/test_m3u8downloaderui.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
import os
import platform
import tkinter as tk
import unittest
from unittest.mock import patch, MagicMock

import pytest

from src import M3U8DownloaderUI
from src import M3U8DownloaderUI, display_settings


class TestM3U8DownloaderUI(unittest.TestCase):
"""Unit test cases for M3U8DownloaderUI"""

def setUp(self):
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')

display_settings()
self.root = tk.Tk()
self.source = M3U8DownloaderUI(self.root)
self.input_url = 'https://raw.githubusercontent.com/coldsofttech/pym3u8downloader/main/tests/files/index.m3u8'
Expand Down
11 changes: 2 additions & 9 deletions tests/unit/test_stdoutredirector.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import os
import platform
import tkinter as tk
import unittest

import pytest

from src import StdoutRedirector
from src import StdoutRedirector, display_settings


class TestStdoutRedirector(unittest.TestCase):
"""Unit test cases for StdoutRedirector"""

def setUp(self):
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')

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

0 comments on commit a692ace

Please sign in to comment.