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 f91b75d commit 8dc55f6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 41 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,16 @@ jobs:
pip install pytest
pip install -r requirements.txt
- name: Install Dependencies (Ubuntu)
- name: Run Tests (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y python3-tk
sudo apt-get install -y xvfb
- name: Start Virtual Display (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
# Xvfb :99 -screen 0 1024x768x16 &
# export DISPLAY=:99
ps aux | grep xvfb
xvfb-run --auto-servernum --server-args='-screen 0 1024x768x24' pytest tests
xvfb-run --auto-servernum --server-args='-screen 0 1024x768x24' pytest tests -vv -rEPW -o pytest_collection_order=alphabetical --cache-clear --color=yes
- name: Run Tests
- name: Run Tests (Windows)
if: matrix.os == 'windows-latest' || matrix.os == 'macos-latest'
run: |
pytest tests -vv -rEPW -o pytest_collection_order=alphabetical --cache-clear --color=yes
Expand Down
17 changes: 1 addition & 16 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,23 +474,8 @@ def _open_license(self, event) -> None:
webbrowser.open(self.license_link)


def get_root_window() -> tk.Tk:
# if platform.system().lower() == 'linux':
# setting = os.environ.__getitem__('DISPLAY')
# return tk.Tk(screenName=setting)
return tk.Tk()


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


def main():
# root = tk.Tk()
root = get_root_window()
root = tk.Tk()
M3U8DownloaderUI(root)
root.mainloop()

Expand Down
6 changes: 2 additions & 4 deletions tests/unit/test_aboutui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@

import pytest

from src import AboutUI, get_root_window
from src import AboutUI


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

def setUp(self):
# display_settings()
# self.root = tk.Tk()
self.root = get_root_window()
self.root = tk.Tk()

def tearDown(self):
try:
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/test_downloadthread.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@

import pytest

from src import M3U8DownloaderUI, DownloadThread, get_root_window
from src import M3U8DownloaderUI, DownloadThread


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

def setUp(self):
# display_settings()
self.root = tk.Tk()
self.input_url = 'https://raw.githubusercontent.com/coldsofttech/pym3u8downloader/main/tests/files/index.m3u8'
self.output_file = 'video.mp4'
# self.root = tk.Tk()
self.root = get_root_window()
self.source = M3U8DownloaderUI(self.root)
self.config_file = 'config.json'

Expand Down
6 changes: 2 additions & 4 deletions tests/unit/test_m3u8downloaderui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@

import pytest

from src import M3U8DownloaderUI, get_root_window
from src import M3U8DownloaderUI


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

def setUp(self):
# display_settings()
# self.root = tk.Tk()
self.root = get_root_window()
self.root = tk.Tk()
self.source = M3U8DownloaderUI(self.root)
self.input_url = 'https://raw.githubusercontent.com/coldsofttech/pym3u8downloader/main/tests/files/index.m3u8'
self.output_file = 'video.mp4'
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/test_stdoutredirector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@

import pytest

from src import StdoutRedirector, get_root_window
from src import StdoutRedirector


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

def setUp(self):
# display_settings()
# self.root = tk.Tk()
self.root = get_root_window()
self.root = tk.Tk()
self.text_variable = tk.StringVar()
self.stdout_redirector = StdoutRedirector(self.text_variable)

Expand Down

0 comments on commit 8dc55f6

Please sign in to comment.