Skip to content

Commit 894dd6c

Browse files
committed
Add initial pytest setup
1 parent abdfee4 commit 894dd6c

4 files changed

Lines changed: 26 additions & 11 deletions

File tree

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ Introduction goes here!
99

1010
* Install Python for your environment and verify the version with:
1111
```
12-
python --version
12+
$ python --version
1313
# or
14-
python3 --version
14+
$ python3 --version
1515
```
1616
This should output a 3.x version number.
1717

1818
* Install up to date versions of pip, setuptools and wheel:
1919
```
20-
python3 -m pip install --upgrade pip setuptools wheel
20+
$ python3 -m pip install --upgrade pip setuptools wheel
2121
```
2222
* Optionally you can use a virtual environment for the previous insall step via the following:
2323
```
24-
python -m venv bb2_env
25-
source bb2_env/bin/activate
24+
$ python -m venv bb2_env
25+
$ source bb2_env/bin/activate
2626
# Perform install and commands after sourcing the venv.
2727
```
2828

@@ -34,22 +34,22 @@ To build the cms-bb2 package do the following:
3434

3535
```
3636
# From repository root directory:
37-
python setup.py bdist_wheel
37+
$ python setup.py bdist_wheel
3838
```
3939

4040
## Installation
4141

4242
To install the package locally do the following:
4343
```
4444
# From repository root directory:
45-
pip install -e .
45+
$ pip install -e .
4646
```
4747

4848
## Usage
4949

5050
To test it out with Python interactively:
5151
```
52-
[cms-bb2-python-sdk]$ python
52+
$ python
5353
Python 3.10.1 ...
5454
Type "help", "copyright", "credits" or "license" for more information.
5555
>>> from bb2 import Bb2
@@ -66,5 +66,12 @@ Hello from BB2 SDK Class method!!!
6666
To install with the tools you need to develop and run tests do the following:
6767

6868
```
69-
pip install -e .[dev]
69+
$ pip install -e .[dev]
70+
```
71+
72+
To run the tests run the following commands:
73+
74+
```
75+
# From the src/ directory
76+
$ pytest
7077
```

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
],
3434
extras_require={
3535
"dev": [
36-
"pytest >= 3.0",
36+
"pytest >= 6.0",
3737
],
3838
},
3939
)

src/bb2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ class Bb2:
99
verbose_name = "Blue Button 2.0 SDK Package"
1010

1111
def hello(self):
12-
print("Hello from BB2 SDK Class method!!!")
12+
mesg = "Hello from BB2 SDK Class method!!!"
13+
print(mesg)
14+
return mesg

src/test_bb2.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from bb2 import Bb2
2+
3+
4+
def test_hello():
5+
bb = Bb2()
6+
assert bb.hello() == "Hello from BB2 SDK Class method!!!"

0 commit comments

Comments
 (0)