MCPcopy Create free account
hub / github.com/numpy/numpy / setup_method

Method setup_method

numpy/distutils/tests/test_system_info.py:144–183  ·  view source on GitHub ↗

Create the libraries

(self)

Source from the content-addressed store, hash-verified

142class TestSystemInfoReading:
143
144 def setup_method(self):
145 """ Create the libraries """
146 # Create 2 sources and 2 libraries
147 self._dir1 = mkdtemp()
148 self._src1 = os.path.join(self._dir1, 'foo.c')
149 self._lib1 = os.path.join(self._dir1, 'libfoo.so')
150 self._dir2 = mkdtemp()
151 self._src2 = os.path.join(self._dir2, 'bar.c')
152 self._lib2 = os.path.join(self._dir2, 'libbar.so')
153 # Update local site.cfg
154 global simple_site, site_cfg
155 site_cfg = simple_site.format(**{
156 'dir1': self._dir1,
157 'lib1': self._lib1,
158 'dir2': self._dir2,
159 'lib2': self._lib2,
160 'pathsep': os.pathsep,
161 'lib2_escaped': _shell_utils.NativeParser.join([self._lib2])
162 })
163 # Write site.cfg
164 fd, self._sitecfg = mkstemp()
165 os.close(fd)
166 with open(self._sitecfg, 'w') as fd:
167 fd.write(site_cfg)
168 # Write the sources
169 with open(self._src1, 'w') as fd:
170 fd.write(fakelib_c_text)
171 with open(self._src2, 'w') as fd:
172 fd.write(fakelib_c_text)
173 # We create all class-instances
174
175 def site_and_parse(c, site_cfg):
176 c.files = [site_cfg]
177 c.parse_config_files()
178 return c
179 self.c_default = site_and_parse(get_class('default'), self._sitecfg)
180 self.c_temp1 = site_and_parse(get_class('temp1'), self._sitecfg)
181 self.c_temp2 = site_and_parse(get_class('temp2'), self._sitecfg)
182 self.c_dup_options = site_and_parse(get_class('duplicate_options'),
183 self._sitecfg)
184
185 def teardown_method(self):
186 # Do each removal separately

Callers

nothing calls this directly

Calls 5

openFunction · 0.85
get_classFunction · 0.85
joinMethod · 0.45
closeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected