Skip to content

Commit 0fc63ef

Browse files
committed
Import from scikit-build-sample-projects
See scikit-build/scikit-build-sample-projects@fdd057a
0 parents  commit 0fc63ef

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

hello/__init__.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
3+
def hello(txt):
4+
print("Hello, %s!" % txt)
5+
6+
7+
def elevation():
8+
"""Returns elevation of Nevado Sajama."""
9+
return 21463

setup.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import sys
2+
3+
from skbuild import setup
4+
5+
# Require pytest-runner only when running tests
6+
pytest_runner = (['pytest-runner>=2.0,<3dev']
7+
if any(arg in sys.argv for arg in ('pytest', 'test'))
8+
else [])
9+
10+
setup_requires = pytest_runner
11+
12+
setup(
13+
name="hello-pure",
14+
version="1.2.3",
15+
description="a minimal example package (pure python version)",
16+
author='The scikit-build team',
17+
license="MIT",
18+
packages=['hello'],
19+
tests_require=['pytest'],
20+
setup_requires=setup_requires
21+
)

test_hello_pure.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import hello
2+
3+
4+
def test_hello(capfd):
5+
hello.hello("World")
6+
captured = capfd.readouterr()
7+
assert captured.out == "Hello, World!"
8+
9+
10+
def test_elevation():
11+
assert hello.elevation() == 21463

0 commit comments

Comments
 (0)