Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
yacmov committed May 30, 2024
1 parent eea37a6 commit 53e8fae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ def update_tesseract_path():
if __name__ == "__main__":
host = "localhost"
port = 5000
if utils.update_port():
port = 5002
else:
if utils.update_port():
port = 5002
else:
port = port
logging.basicConfig(filename="app.log", filemode="w", level=logging.DEBUG, format="%(levelname)s - %(message)s")
print("[*] Starting OcrRoo Server")
Expand Down
7 changes: 4 additions & 3 deletions app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os.path
import hashlib
import json
import os.path
import shutil
import subprocess
import logging
Expand All @@ -18,6 +17,7 @@

sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))


def config(section: str = None, option: str = None) -> Union[ConfigParser, str]:
"""
Loads config variables from file and returns either specified variable or parser object. If attempting to
Expand Down Expand Up @@ -534,11 +534,12 @@ def extract_form_values(request):
}
}

def update_port()->bool:

def update_port() -> bool:
"""
Checks if the current platform is a Unix-based system (like Darwin or Linux). If so, returns True.
Returns:
Returns:
bool - True if running on a Unix-based system, False otherwise
"""
if sys.platform.lower() in ['darwin', 'linux']:
Expand Down
5 changes: 3 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ def test_file_already_exists_no_user_data(mocker):
assert not utils.file_already_exists("4aj3sdl5a4k2sjd091u091j")


def test_set_port_for_macos():
def test_set_port_for_macos():
port = 5000
if sys.platform.lower() in ["darwin", 'linux']:
port = 5002
assert not port == 5000
assert not port == 5000

0 comments on commit 53e8fae

Please sign in to comment.