Show More
@@ -165,7 +165,6 b' class OSMagics(Magics):' | |||
|
165 | 165 | |
|
166 | 166 | path = [os.path.abspath(os.path.expanduser(p)) for p in |
|
167 | 167 | os.environ.get('PATH','').split(os.pathsep)] |
|
168 | path = filter(os.path.isdir,path) | |
|
169 | 168 | |
|
170 | 169 | syscmdlist = [] |
|
171 | 170 | # Now define isexec in a cross platform manner. |
@@ -189,8 +188,12 b' class OSMagics(Magics):' | |||
|
189 | 188 | # the innermost part |
|
190 | 189 | if os.name == 'posix': |
|
191 | 190 | for pdir in path: |
|
191 | try: | |
|
192 | 192 | os.chdir(pdir) |
|
193 |
|
|
|
193 | dirlist = os.listdir(pdir) | |
|
194 | except OSError: | |
|
195 | continue | |
|
196 | for ff in dirlist: | |
|
194 | 197 | if isexec(ff): |
|
195 | 198 | try: |
|
196 | 199 | # Removes dots from the name since ipython |
@@ -205,8 +208,12 b' class OSMagics(Magics):' | |||
|
205 | 208 | else: |
|
206 | 209 | no_alias = Alias.blacklist |
|
207 | 210 | for pdir in path: |
|
211 | try: | |
|
208 | 212 | os.chdir(pdir) |
|
209 |
|
|
|
213 | dirlist = os.listdir(pdir) | |
|
214 | except OSError: | |
|
215 | continue | |
|
216 | for ff in dirlist: | |
|
210 | 217 | base, ext = os.path.splitext(ff) |
|
211 | 218 | if isexec(ff) and base.lower() not in no_alias: |
|
212 | 219 | if ext.lower() == '.exe': |
@@ -15,6 +15,7 b' import argparse' | |||
|
15 | 15 | import json |
|
16 | 16 | import multiprocessing.pool |
|
17 | 17 | import os |
|
18 | import stat | |
|
18 | 19 | import re |
|
19 | 20 | import requests |
|
20 | 21 | import shutil |
@@ -170,6 +171,18 b' class PyTestController(TestController):' | |||
|
170 | 171 | # This means we won't get odd effects from our own matplotlib config |
|
171 | 172 | self.env['MPLCONFIGDIR'] = workingdir.name |
|
172 | 173 | |
|
174 | # Add a non-accessible directory to PATH (see gh-7053) | |
|
175 | noaccess = os.path.join(self.workingdir.name, "_no_access_") | |
|
176 | self.noaccess = noaccess | |
|
177 | os.mkdir(noaccess, 0) | |
|
178 | ||
|
179 | PATH = os.environ.get('PATH', '') | |
|
180 | if PATH: | |
|
181 | PATH = noaccess + os.pathsep + PATH | |
|
182 | else: | |
|
183 | PATH = noaccess | |
|
184 | self.env['PATH'] = PATH | |
|
185 | ||
|
173 | 186 | # From options: |
|
174 | 187 | if self.options.xunit: |
|
175 | 188 | self.add_xunit() |
@@ -178,6 +191,14 b' class PyTestController(TestController):' | |||
|
178 | 191 | self.env['IPTEST_SUBPROC_STREAMS'] = self.options.subproc_streams |
|
179 | 192 | self.cmd.extend(self.options.extra_args) |
|
180 | 193 | |
|
194 | def cleanup(self): | |
|
195 | """ | |
|
196 | Make the non-accessible directory created in setup() accessible | |
|
197 | again, otherwise deleting the workingdir will fail. | |
|
198 | """ | |
|
199 | os.chmod(self.noaccess, stat.S_IRWXU) | |
|
200 | TestController.cleanup(self) | |
|
201 | ||
|
181 | 202 | @property |
|
182 | 203 | def will_run(self): |
|
183 | 204 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now