diff --git a/Tests/Unit Testing/test_center_window.py b/Tests/Unit Testing/test_center_window.py new file mode 100644 index 0000000..65d3514 --- /dev/null +++ b/Tests/Unit Testing/test_center_window.py @@ -0,0 +1,32 @@ +import os +import sys +import tkinter + +sys.path.append(os.path.abspath(os.path.join(os.path.abspath(__file__), '../../../sources/Overwatch Rank Tracker'))) +import MainWindow # noqa: E402. It imports it and recognizes it, I don't know why the Python interpreter is flagging an error + + +def test_center_window(): + """""" + + # create window + test_window = tkinter.Tk() + + # set window size + window_width = 125 + window_height = 225 + + # calling window centering function + MainWindow.center_window(window=test_window, window_height=window_height, window_width=window_width) + + # getting window coordinates after centering + x_coord = test_window.winfo_x() + y_coord = test_window.winfo_y() + + # calculate expected coordinates for centered window + screen_width = test_window.winfo_screenwidth() + screen_height = test_window.winfo_screenheight() + expected_x = (screen_width / 2) - (window_width / 2) + expected_y = (screen_height / 2) - (window_height / 2) + + assert (x_coord, y_coord) == (expected_x, expected_y) diff --git a/Tests/Unit Testing/test_create_and_configure_window.py b/Tests/Unit Testing/test_create_and_configure_window.py new file mode 100644 index 0000000..e69de29 diff --git a/Tests/Unit Testing/test_set_settings.py b/Tests/Unit Testing/test_set_settings.py new file mode 100644 index 0000000..e69de29 diff --git a/sources/Project Manager/ProjectManager.py b/sources/Project Manager/ProjectManager.py index 111cafc..e3f9298 100644 --- a/sources/Project Manager/ProjectManager.py +++ b/sources/Project Manager/ProjectManager.py @@ -1,16 +1,17 @@ import configparser import os +import sys import ConsoleManager import TokenManager -class ReleaseCreator: +class ProjectManager: def __init__(self): # get paths - self.project_directory_path = os.path.abspath(os.path.join(os.path.abspath(__file__), '../../..')) + self.project_directory_path = os.path.abspath(os.path.join(sys.argv[0], '../../..')) self.zip_file_path = os.path.join(self.project_directory_path, "Overwatch Rank Tracker.zip") config_file_path = os.path.join(self.project_directory_path, 'resources', 'config.ini') @@ -37,5 +38,5 @@ def run(self): if __name__ == "__main__": - releaseCreator = ReleaseCreator() - releaseCreator.run() + projectManager = ProjectManager() + projectManager.run() diff --git a/sources/Project Manager/PushManager.py b/sources/Project Manager/PushManager.py index e08907e..2159e9b 100644 --- a/sources/Project Manager/PushManager.py +++ b/sources/Project Manager/PushManager.py @@ -16,7 +16,7 @@ def push_new_commit(self, commit_message: str): self.__git_add() subprocess.run(["git", "commit", "-m", commit_message]) subprocess.run(["git", "push", "origin", "master"]) - time.sleep(3) + time.sleep(5) def push_replacing_last_commit(self, commit_message: str = None): """Commands to replace last commit and possibly its message.""" @@ -32,4 +32,4 @@ def push_replacing_last_commit(self, commit_message: str = None): subprocess.run(["git", "commit", "--amend", "-m", commit_message]) subprocess.run(["git", "push", "--force"]) - time.sleep(3) + time.sleep(5)