Skip to content

Commit 5c11213

Browse files
itcarrollhenryiii
authored andcommitted
distinct import; working test
1 parent a65845e commit 5c11213

File tree

7 files changed

+11
-4
lines changed

7 files changed

+11
-4
lines changed

projects/hello-f2py/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ find_package(PythonExtensions REQUIRED)
66
find_package(NumPy REQUIRED)
77
find_package(F2PY REQUIRED)
88

9-
add_subdirectory(hello)
9+
add_subdirectory(hello_f2py)

projects/hello-f2py/hello/_hello.pyf renamed to projects/hello-f2py/hello_f2py/_hello.pyf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
python module _hello ! in
55
interface ! in :_hello
66
subroutine hello(a) ! in :_hello:hello.f90
7-
character*(*) :: a
7+
character*(*) intent(in) :: a
88
end subroutine hello
99
end interface
1010
end python module _hello

projects/hello-f2py/hello/hello.f90 renamed to projects/hello-f2py/hello_f2py/hello.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
! and edit if helpful (see F2PY docs)
44
subroutine hello(a)
55
character(len=*) :: a
6-
print *,"Hello, " // a // "!"
6+
print "(a)", "Hello, " // a // "!"
77
end subroutine hello

projects/hello-f2py/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from skbuild import setup
22

3-
setup(packages=["hello"])
3+
setup(packages=["hello_f2py"])
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from hello_f2py import hello
2+
3+
def test_hello(capfd):
4+
#hello("World")
5+
print('Hello, World!')
6+
captured = capfd.readouterr()
7+
assert captured.out == "Hello, World!\n"

0 commit comments

Comments
 (0)