From 4a2029fadb8346c93f3d70c1ba28419c47623925 Mon Sep 17 00:00:00 2001 From: dh00601 <dh00601@surrey.ac.uk> Date: Sat, 9 Oct 2021 00:17:43 +0100 Subject: [PATCH] fixing failing tests --- binarycpython/tests/test_functions.py | 7 ++++--- binarycpython/utils/functions.py | 2 +- binarycpython/utils/grid.py | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/binarycpython/tests/test_functions.py b/binarycpython/tests/test_functions.py index 46bfbbbfc..86c24698c 100644 --- a/binarycpython/tests/test_functions.py +++ b/binarycpython/tests/test_functions.py @@ -13,7 +13,6 @@ from binarycpython.utils.functions import * TMP_DIR = temp_dir("tests", "test_functions") - class dummy: """ Dummy class to be used in the merge_dicts @@ -106,14 +105,16 @@ class test_temp_dir(unittest.TestCase): Test making a temp directory and comparing that to what it should be """ + # binary_c_temp_dir = temp_dir() + username = get_username() general_temp_dir = tempfile.gettempdir() self.assertTrue( - os.path.isdir(os.path.join(general_temp_dir, "binary_c_python")) + os.path.isdir(os.path.join(general_temp_dir, "binary_c_python-{}".format(username))) ) self.assertTrue( - os.path.join(general_temp_dir, "binary_c_python") + os.path.join(general_temp_dir, "binary_c_python-{}".format(username)) ) == binary_c_temp_dir diff --git a/binarycpython/utils/functions.py b/binarycpython/utils/functions.py index 9c304b557..e67686fcb 100644 --- a/binarycpython/utils/functions.py +++ b/binarycpython/utils/functions.py @@ -67,7 +67,7 @@ def check_if_in_shell(): return in_shell -def ANSI_colours(self): +def get_ANSI_colours(): # ANSI colours dictionary foreground_colours = { "red": Fore.RED, diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index 81ae2cae7..b98a129fc 100644 --- a/binarycpython/utils/grid.py +++ b/binarycpython/utils/grid.py @@ -80,7 +80,7 @@ from binarycpython.utils.functions import ( trem, conv_time_units, mem_use, - ANSI_colours, + get_ANSI_colours, check_if_in_shell, format_number, ) @@ -175,7 +175,7 @@ class Population: self.in_shell = check_if_in_shell() # ANSI colours: use them if in a shell - self.ANSI_colours = ANSI_colours() + self.ANSI_colours = get_ANSI_colours() if self.in_shell == False: for c in self.ANSI_colours: self.ANSI_colours[c] = "" -- GitLab