Skip to content

Commit

Permalink
gitdist: Move to Base Dir (TriBITSPub#212)
Browse files Browse the repository at this point in the history
Added setUp() and tearDown() methods to each unittest class to clear the
GITDIST_MOVE_TO_BASE_DIR environment variable before each test and then
restore it after.
  • Loading branch information
jmgate committed Nov 2, 2017
1 parent 3b2f98a commit 0250225
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions test/python_utils/gitdist_UnitTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ def __init__(self, useGit):
class test_createAsciiTable(unittest.TestCase):


def setUp(self):
self.gitdistMoveToBaseDir = os.environ["GITDIST_MOVE_TO_BASE_DIR"]
os.environ["GITDIST_MOVE_TO_BASE_DIR"] = ""


def tearDown(self):
os.environ["GITDIST_MOVE_TO_BASE_DIR"] = self.gitdistMoveToBaseDir


def test_full_table(self):
tableData = [
{ "label" : "ID", "align" : "R",
Expand Down Expand Up @@ -197,6 +206,15 @@ def test_row_mismatch(self):
class test_gitdist_getRepoStats(unittest.TestCase):


def setUp(self):
self.gitdistMoveToBaseDir = os.environ["GITDIST_MOVE_TO_BASE_DIR"]
os.environ["GITDIST_MOVE_TO_BASE_DIR"] = ""


def tearDown(self):
os.environ["GITDIST_MOVE_TO_BASE_DIR"] = self.gitdistMoveToBaseDir


def test_no_change(self):
try:
testDir = createAndMoveIntoTestDir("gitdist_getRepoStats_no_change")
Expand Down Expand Up @@ -562,7 +580,12 @@ class test_gitdist_getRepoVersionDictFromRepoVersionFileString(unittest.TestCase


def setUp(self):
None
self.gitdistMoveToBaseDir = os.environ["GITDIST_MOVE_TO_BASE_DIR"]
os.environ["GITDIST_MOVE_TO_BASE_DIR"] = ""


def tearDown(self):
os.environ["GITDIST_MOVE_TO_BASE_DIR"] = self.gitdistMoveToBaseDir


def test_repoVersionFile_withSummary_1(self):
Expand Down Expand Up @@ -626,7 +649,12 @@ class test_gitdist(unittest.TestCase):


def setUp(self):
None
self.gitdistMoveToBaseDir = os.environ["GITDIST_MOVE_TO_BASE_DIR"]
os.environ["GITDIST_MOVE_TO_BASE_DIR"] = ""


def tearDown(self):
os.environ["GITDIST_MOVE_TO_BASE_DIR"] = self.gitdistMoveToBaseDir


def test_default(self):
Expand Down

0 comments on commit 0250225

Please sign in to comment.