- Python 94.5%
- Gherkin 3.8%
- Dockerfile 1.7%
|
|
||
|---|---|---|
| .devcontainer | ||
| .forgejo/workflows | ||
| .vscode | ||
| features | ||
| tests | ||
| torpydo | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| buildpipeline.yml | ||
| config.toml | ||
| Dockerfile | ||
| DockerfileBuild | ||
| MANIFEST | ||
| MANIFEST.in | ||
| nose2.cfg | ||
| README.md | ||
| requirements.txt | ||
| setup.py | ||
| start.py | ||
Torpydo - Battleship Python
A simple game of Battleship, written in Python. The purpose of this repository is to serve as an entry point into coding exercises and it was especially created for scrum.orgs Applying Professional Scrum for Software Development course (www.scrum.org/apssd). The code in this repository is unfinished by design.
Getting started
This project requires Python 3.12 or newer. To prepare to work with it, pick one of these options:
Linux and macOS
Create and activate a virtual environment. This assumes python3 is already installed.
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
export PYTHONPATH=.
If you stop working on this project, close your shell, and return later, make
sure you run the source bin/venv/activate command again.
Windows
Download and install Python for Windows. Make sure python is on
your PATH. Use the Python install manager to help set up dependencies and PATH variables.
Open a command prompt:
python -m venv venv
venv\Scripts\activate.bat
pip install -r requirements.txt
set PYTHONPATH=.
Docker
If you don't want to install anything Python-related on your system, you can run the game inside Docker instead.
Build the Docker Image
docker build -t torpydo .
Run a Docker Container from the Image
docker run -it --env PYTHONPATH=/torpydo -v ${PWD}:/torpydo torpydo bash
Launching the game
python -m torpydo
# alternatively:
python torpydo/battleship.py
Running the Tests
nose2 -v
behave
to run with coverage:
nose2 -v --with-coverage --coverage ./torpydo
to run and store the test results for further examination (e.g. build pipeline)
nose2 --v --junit-xml --junit-xml-path xunit.xml
behave --junit
Run behave tests with coverage:
https://stackoverflow.com/a/37447392/736079
Telemetry data
This application is collecting telemetry data with Microsoft Application Insights. For more details see https://docs.microsoft.com/en-us/azure/azure-monitor/app/opencensus-python.
To send the telemetry data to a specific instance of Application Insights, the connection string has to be adjusted in telemetryclient.py