Skip to content

Commit

Permalink
Adding tests. Small changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
enexety committed Sep 30, 2023
1 parent 4cce157 commit 96f96f0
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
32 changes: 32 additions & 0 deletions Tests/Unit Testing/test_center_window.py
Original file line number Diff line number Diff line change
@@ -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)
Empty file.
Empty file.
9 changes: 5 additions & 4 deletions sources/Project Manager/ProjectManager.py
Original file line number Diff line number Diff line change
@@ -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')

Expand All @@ -37,5 +38,5 @@ def run(self):


if __name__ == "__main__":
releaseCreator = ReleaseCreator()
releaseCreator.run()
projectManager = ProjectManager()
projectManager.run()
4 changes: 2 additions & 2 deletions sources/Project Manager/PushManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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)

0 comments on commit 96f96f0

Please sign in to comment.