Skip to content

Commit

Permalink
Add tests (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
trumully authored Sep 11, 2024
1 parent 1b31e7c commit e90da25
Show file tree
Hide file tree
Showing 23 changed files with 967 additions and 599 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test and Lint

on:
push:
branches:
- main
paths:
- dynamo/**/*.py
- tests/**/*.py
pull_request:
types: [opened, reopened, synchronize]
paths:
- dynamo/**/*.py
- tests/**/*.py

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ruff:
name: Lint with ruff
runs-on: ubuntu-22.04
concurrency: lint
steps:
- uses: actions/checkout@v4
- uses: jpetrucciani/ruff-check@main
with:
path: './dynamo/'
flags: '--config ./pyproject.toml'

tests:
name: Test with pytest
strategy:
matrix:
os: [ubuntu-22.04, windows-2022]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'
- run: poetry install --with=dev
- run: poetry run pytest tests --asyncio-mode=strict -n logical
28 changes: 0 additions & 28 deletions .github/workflows/ruff.yml

This file was deleted.

19 changes: 18 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@
"request": "launch",
"program": "${workspaceFolder}/dynamo/launcher.py",
"console": "integratedTerminal"
},
{
"name": "Dynamo Tests",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"args": [
"tests",
"--asyncio-mode=strict",
"-n",
"logical",
],
"console": "integratedTerminal",
"justMyCode": true,
"env": {
"PYDEVD_DISABLE_FILE_VALIDATION": "1",
}
}
]
}
}
14 changes: 12 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"python.REPL.enableREPLSmartSend": false,
"editor.defaultFormatter": "charliermarsh.ruff",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
},
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
Expand All @@ -11,5 +13,13 @@
"**/.ruff_cache": true
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true
"files.trimTrailingWhitespace": true,
"python.testing.pytestArgs": [
"tests",
"--asyncio-mode=strict",
"-n",
"logical",
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,34 @@ Personal use bot.

## Setup
### Prerequisites
`poetry` is required to set up Dynamo. Find installation instructions [here](https://python-poetry.org/docs/)
`poetry` is required to set up Dynamo. Find installation instructions [here](https://python-poetry.org/docs/)
### Installing
#### Clone the repository:
```shell
git clone https://github.com/trumully/Dynamo
```
#### Install and run:
```shell
poetry install
poetry install
poetry run dynamo setup
poetry run dynamo
```

## Development
### Install dev dependencies
```shell
poetry install --with=dev
```
### Run tests
#### CLI
```shell
poetry run pytest tests --asyncio-mode=strict -n logical
```
#### VSCode
1. Open VSCode debugger `Ctrl+Shift+D`
2. Run `Dynamo Tests` preset

**or**

1. Open Command Palette `Ctrl+Shift+P`
2. Search and run: `Tests: Run All Tests`
175 changes: 0 additions & 175 deletions dynamo/ext/debug.py

This file was deleted.

Loading

0 comments on commit e90da25

Please sign in to comment.