-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from TechnologyBrewery/6-create-behave-plugin
6 - Create behave plugin goal
- Loading branch information
Showing
23 changed files
with
233 additions
and
1,788 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Pants workspace files | ||
/.pants.d | ||
/dist/ | ||
**/dist/ | ||
__pycache__/ | ||
.venv/ | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# example-project | ||
This is an example project used to test out the pants plugins. | ||
|
||
## Set up | ||
This project was generated by running `uv init example-project --lib` within the root project directory. | ||
|
||
## Adding dependencies | ||
The dependencies were added to the `pyproject.toml` file by running the following. | ||
``` | ||
cd example-project | ||
uv add behave numpy | ||
``` | ||
|
||
## Run Sample Code | ||
To run the sample code, | ||
``` | ||
cd example-project | ||
uv run python src/example_project/generate_array.py | ||
``` | ||
|
||
## Run Tests | ||
|
||
## Behave Test | ||
To run the behave unit tests, | ||
``` | ||
cd example-project | ||
uv run behave tests/features | ||
``` | ||
|
||
## PyTest Test | ||
To run the PyTest tests, | ||
``` | ||
cd example-project | ||
uv run pytest pytests | ||
``` | ||
|
||
## Monorepo Level Build Lifecyle | ||
Often times, when we are working in a monorepo, we want to be able to run commands within a module, but also at the root project level. In this README, we treat `example-project` as a module within the `pants-uv-lifecycle-plugin` monorepo. In the above sections, we give the `uv` commands to run within this module. We can run these same commands* across the entire monorepo at the root project level. To do so, checkout the [Current Available Plugins](../README.md#current-available-plugins) the root [README](../README.md). | ||
|
||
* Note: We cannot run the `uv run pytest` command currently from the root project level. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[project] | ||
name = "example-project" | ||
version = "0.1.0" | ||
description = "A simple project to illustrate the `pants-uv-lifecycle-plugin` plugins" | ||
readme = "README.md" | ||
authors = [ | ||
{ name = "Margaret Black", email = "black_margaret@bah.com" } | ||
] | ||
requires-python = ">=3.9" | ||
dependencies = [ | ||
"behave>=1.2.6", | ||
"numpy>=2.0.2", | ||
"pytest>=8.3.4", | ||
] | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import numpy as np | ||
from src.example_project.generate_array import generate_array | ||
|
||
def test_generate_array(): | ||
numpy_array = generate_array() | ||
numpy_array_type = type(numpy_array) | ||
assert isinstance(numpy_array, np.ndarray), f'The numpy_array is of type {numpy_array_type}, but it was expected to be of type numpy.ndarray.' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import numpy as np | ||
|
||
def generate_array(): | ||
return np.arange(10) | ||
|
||
if __name__ == '__main__': | ||
print('numpy array: ', generate_array()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Feature: Simple test to verify we can generate a numpy array | ||
|
||
Scenario: Generate a numpy array | ||
When the generate numpy array functionality is executed | ||
Then a numpy array is generated |
12 changes: 12 additions & 0 deletions
12
example-project/tests/features/steps/generate_array_step.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from behave import when, then | ||
import numpy as np | ||
from src.example_project.generate_array import generate_array | ||
|
||
@when("the generate numpy array functionality is executed") | ||
def step_impl(context): | ||
context.numpy_array = generate_array() | ||
|
||
@then("a numpy array is generated") | ||
def step_impl(context): | ||
numpy_array_type = type(context.numpy_array) | ||
assert isinstance(context.numpy_array, np.ndarray), f'The context.numpy_array is of type {numpy_array_type}, but it was expected to be of type numpy.ndarray.' |
Oops, something went wrong.