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