File: dont_delete_tmp

package info (click to toggle)
python-apptools 4.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,652 kB
  • sloc: python: 16,657; makefile: 77
file content (59 lines) | stat: -rw-r--r-- 2,173 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Description: fixes deletion of /tmp in chroot
 Self tests will fail if we build this package in an isolated chroot
 environment.
 .
 That's because os.removedirs() was used. This deletes parent directories if
 empty. In our case, we were building with root permissions (normal for
 chroot), in an isolated enviornment. The /tmp directory was empty, so when
 tests ran os.removedirs(), /tmp was also deleted. The next test that tried to
 tempfile.mkdtemp() would fail because it couldn't create a new directory in
 /tmp because /tmp didn't exist.
Author: Stewart Ferguson <stew@ferg.aero>
Forwarded: https://github.com/enthought/apptools/pull/85
Last-Update: 2019-01-23
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/apptools/preferences/tests/preferences_test_case.py
+++ b/apptools/preferences/tests/preferences_test_case.py
@@ -40,7 +40,7 @@ class PreferencesTestCase(unittest.TestC
         """ Called immediately after each test method has been called. """
 
         # Remove the temporary directory.
-        os.removedirs(self.tmpdir)
+        os.rmdir(self.tmpdir)
 
         return
 
--- a/apptools/preferences/tests/preference_binding_test_case.py
+++ b/apptools/preferences/tests/preference_binding_test_case.py
@@ -211,7 +211,7 @@ class PreferenceBindingTestCase(unittest
 
         # Clean up!
         os.remove(tmp)
-        os.removedirs(tmpdir)
+        os.rmdir(tmpdir)
 
         return
 
--- a/apptools/preferences/tests/py_config_file_test_case.py
+++ b/apptools/preferences/tests/py_config_file_test_case.py
@@ -122,7 +122,7 @@ class PyConfigFileTestCase(unittest.Test
         finally:
             # Clean up!
             os.remove(tmp)
-            os.removedirs(tmpdir)
+            os.rmdir(tmpdir)
 
         return
 
--- a/apptools/preferences/tests/scoped_preferences_test_case.py
+++ b/apptools/preferences/tests/scoped_preferences_test_case.py
@@ -43,7 +43,7 @@ class ScopedPreferencesTestCase(Preferen
         """ Called immediately after each test method has been called. """
 
         # Remove the temporary directory.
-        os.removedirs(self.tmpdir)
+        os.rmdir(self.tmpdir)
 
         return