Skip to content

Commit 2d16be0

Browse files
committed
Switched to a temporary directory for unit testing
1 parent a5402ae commit 2d16be0

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: test/parser_test.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import os
1212
import unittest
1313
import testfixtures
14-
import shutil
1514

1615
import lbuild
1716

@@ -135,17 +134,16 @@ def test_shouldMergeBuildModuleOptions(self):
135134
self.assertEqual(options["repo1:other:foo"].value, "456")
136135
self.assertEqual(options["repo1:other:bar"].value, "768")
137136

138-
def test_shouldBuildModules(self):
137+
@testfixtures.tempdir()
138+
def test_shouldBuildModules(self, d):
139139
build_modules, config_options, repo_options = self._get_build_modules()
140140
module_options = self.parser.merge_module_options(build_modules, config_options)
141141

142-
outpath = "build"
142+
outpath = d.path
143143
self.parser.build_modules(outpath, build_modules, repo_options, module_options)
144144

145145
self.assertTrue(os.path.isfile(os.path.join(outpath, "src/other.cpp")))
146146
self.assertTrue(os.path.isfile(os.path.join(outpath, "test/other.cpp")))
147-
148-
shutil.rmtree(outpath)
149147

150148
if __name__ == '__main__':
151149
unittest.main()

0 commit comments

Comments
 (0)