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

Method setup_method

numpy/f2py/tests/util.py:367–419  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

365 return f'_{cls.__module__.rsplit(".",1)[-1]}_{cls.__name__}_ext_module'
366
367 def setup_method(self):
368 if sys.platform == "win32":
369 pytest.skip("Fails with MinGW64 Gfortran (Issue #9673)")
370
371 if self.module is not None:
372 return
373
374 # Check compiler availability first
375 if not has_c_compiler():
376 pytest.skip("No C compiler available")
377
378 codes = []
379 if self.sources:
380 codes.extend(self.sources)
381 if self.code is not None:
382 codes.append(self.suffix)
383
384 needs_f77 = False
385 needs_f90 = False
386 needs_pyf = False
387 for fn in codes:
388 if str(fn).endswith(".f"):
389 needs_f77 = True
390 elif str(fn).endswith(".f90"):
391 needs_f90 = True
392 elif str(fn).endswith(".pyf"):
393 needs_pyf = True
394 if needs_f77 and not has_f77_compiler():
395 pytest.skip("No Fortran 77 compiler available")
396 if needs_f90 and not has_f90_compiler():
397 pytest.skip("No Fortran 90 compiler available")
398 if needs_pyf and not (has_f90_compiler() or has_f77_compiler()):
399 pytest.skip("No Fortran compiler available")
400
401 # Build the module
402 if self.code is not None:
403 self.module = build_code(
404 self.code,
405 options=self.options,
406 skip=self.skip,
407 only=self.only,
408 suffix=self.suffix,
409 module_name=self.module_name,
410 )
411
412 if self.sources is not None:
413 self.module = build_module(
414 self.sources,
415 options=self.options,
416 skip=self.skip,
417 only=self.only,
418 module_name=self.module_name,
419 )
420
421
422#

Callers

nothing calls this directly

Calls 6

has_c_compilerFunction · 0.85
has_f77_compilerFunction · 0.85
has_f90_compilerFunction · 0.85
build_codeFunction · 0.85
build_moduleFunction · 0.85
endswithMethod · 0.80

Tested by

no test coverage detected