Skip to content

Commit 6afe07f

Browse files
itcarrollhenryiii
authored andcommitted
hello-f2py passing pytest
1 parent dec78ae commit 6afe07f

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
add_f2py_target(_hello _hello.pyf hello.f90)
2-
add_library(_hello MODULE ${_hello})
3-
python_extension_module(_hello)
4-
1+
add_f2py_target(_hello _hello.pyf)
2+
add_library(_hello MODULE ${_hello} hello.f90)
53
target_link_libraries(_hello ${F2PY_LIBRARIES})
64
target_include_directories(_hello PRIVATE ${F2PY_INCLUDE_DIRS})
5+
python_extension_module(_hello)
76

87
install(TARGETS _hello LIBRARY DESTINATION hello_f2py)

projects/hello-f2py/hello_f2py/hello.f90

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
! $ python -m numpy.f2py hello.f90 -m _hello -h _hello.pyf
33
! and edit if helpful (see F2PY docs)
44
subroutine hello(a)
5+
use, intrinsic :: iso_fortran_env
56
character(len=*) :: a
6-
print "(a)", "Hello, " // a // "!"
7+
print '(A)', 'Hello, ' // a // '!'
8+
flush(OUTPUT_UNIT)
79
end subroutine hello

projects/hello-f2py/pyproject.toml

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ authors = [
77
]
88
license = {text = "MIT"}
99
requires-python = ">=3.7"
10+
dependencies = [
11+
"numpy",
12+
]
1013

1114
[build-system]
1215
requires = [
13-
"setuptools>=42",
14-
"scikit-build>=0.13",
15-
"cmake>=3.18",
16+
"setuptools",
17+
"scikit-build",
18+
"cmake",
1619
"ninja",
1720
"cython",
1821
"numpy",
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from hello_f2py import hello
22

3+
34
def test_hello(capfd):
4-
#hello("World")
5-
print('Hello, World!')
5+
hello('World')
66
captured = capfd.readouterr()
7-
assert captured.out == "Hello, World!\n"
7+
assert captured.out == 'Hello, World!\n'

0 commit comments

Comments
 (0)