File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,11 +29,31 @@ class TestBase(unittest.TestCase):
2929 """Unittest base abstract class"""
3030
3131 # This variable must be overwritten in each subclass!
32- __test_path__ : str = os .path .abspath (__file__ )
32+ __test_path__ : str = None
33+ BAZEL_BIN_DIR : str = None
34+ BAZEL_TESTLOGS_DIR : str = None
3335
3436 @classmethod
3537 def setUpClass (cls ):
3638 """Load module, save environment"""
39+ ErrorCollector : list [str ] = []
40+ if cls .__test_path__ == None :
41+ ErrorCollector .append (
42+ "Test path must be overwritten! Use:"
43+ "\n __test_path__ = os.path.dirname(os.path.abspath(__file__))"
44+ )
45+ if cls .BAZEL_BIN_DIR == None :
46+ ErrorCollector .append (
47+ "Bazel bin directory must be overwritten! Use:"
48+ "../../../bazel-bin/test/unit/my_test_folder"
49+ )
50+ if cls .BAZEL_TESTLOGS_DIR == None :
51+ ErrorCollector .append (
52+ "Bazel test logs directory must be overwritten! Use:"
53+ "../../../bazel-testlogs/test/unit/my_test_folder"
54+ )
55+ if ErrorCollector :
56+ raise NotImplementedError ("\n " .join (ErrorCollector ))
3757 # Enable debug logs for tests if "super verbose" flag is provided
3858 if "-vvv" in sys .argv :
3959 logging .basicConfig (
Original file line number Diff line number Diff line change 1919import unittest
2020from common .base import TestBase
2121
22- # TODO: fix folder name
23- BAZEL_BIN_DIR = os .path .join ("../../.." , "bazel-bin" , "test" ,
24- "unit" , "my_test_folder" )
25- BAZEL_TESTLOGS_DIR = os .path .join ("../../.." , "bazel-testlogs" , "test" ,
26- "unit" , "my_test_folder" )
2722
2823class TestTemplate (TestBase ):
2924 """TODO: Add a description"""
3025 # Set working directory
3126 __test_path__ = os .path .dirname (os .path .abspath (__file__ ))
27+ # TODO: fix folder name
28+ BAZEL_BIN_DIR = os .path .join ("../../.." , "bazel-bin" , "test" ,
29+ "unit" , "my_test_folder" )
30+ BAZEL_TESTLOGS_DIR = os .path .join ("../../.." , "bazel-testlogs" , "test" ,
31+ "unit" , "my_test_folder" )
3232
3333 def setUp (self ):
3434 """TODO: Define clean up before every test"""
You can’t perform that action at this time.
0 commit comments