Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Python Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsecret-1-0 libgirepository1.0-dev

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build pytest pytest-asyncio pytest-cov
pip install -e .[test,linux]

- name: Run database, utils, and system stats tests
run: |
python -m pytest tests/test_database.py tests/test_utils.py tests/test_system_stats.py -v

- name: Run TUI tests (nest module)
env:
PYTEST_RUNNING: 1
TERM: xterm-256color
PYTHONPATH: ${{ github.workspace }}
run: |
python -m pytest tests/test_nest.py -v

- name: Run remaining tests
run: |
python -m pytest --cov=ticked --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: false
32 changes: 0 additions & 32 deletions .github/workflows/test.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,55 @@ poetry.lock
quotes_cache.json
docs/images/autoindent.gif
docs/images/autopair.gif
htmlcov/
.coverage
coverage.xml
test-env/

project_deps.txt
project_requirements.txt

.coverage.*
.pytest_cache/
coverage/

venv/
.venv/
env/
.env/

.idea/
.vscode/
*.code-workspace

__pycache__/
*.py[cod]
*$py.class

.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
*.tmp
*.bak
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
<br>
[![Lint](https://github.com/cachebag/Ticked/actions/workflows/lint.yml/badge.svg)](https://github.com/USERNAME/REPO/actions/workflows/lint.yml)
<br>
[![Tests](https://github.com/cachebag/Ticked/actions/workflows/test.yml/badge.svg)](https://github.com/USERNAME/REPO/actions/workflows/test.yml)
<br>
[![Security](https://github.com/cachebag/Ticked/actions/workflows/security.yml/badge.svg)](https://github.com/USERNAME/REPO/actions/workflows/security.yml)
<br>

[![Python Tests](https://github.com/USERNAME/Ticked/actions/workflows/pytest.yml/badge.svg)](https://github.com/cachebag/Ticked/actions/workflows/pytest.yml/badge.svg)

# 📟 **Ticked** is a Terminal based task and productivity manager built in Python over the Textual framework.

Expand Down Expand Up @@ -65,3 +63,35 @@ If you want to contribute:
2. Make your changes.
3. Submit a pull request for review.

## Testing

```bash
pytest
```

## Development

### Running CI Checks Locally

You can run the same checks that run in GitHub Actions locally using the provided script:

1. First, make the script executable:
```bash
chmod +x run_checks.sh
```

2. Install development dependencies:
```bash
pip install -r requirements-dev.txt
```

3. Run specific checks:
- For security checks: `./run_checks.sh security`
- For linting: `./run_checks.sh lint`
- For tests: `./run_checks.sh pytest`
- For all checks: `./run_checks.sh all`

## License

[MIT](LICENSE)

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ dependencies = [
"vobject",
"x-wr-timezone",
"yarl",
"jedi"
"jedi",
"send2trash"
]

[project.urls]
Expand Down
14 changes: 14 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[pytest]
testpaths = tests
python_files = test_*.py
python_functions = test_*
asyncio_mode = strict
log_cli = true
log_cli_level = INFO

filterwarnings =
ignore::RuntimeWarning:unittest.mock
ignore::RuntimeWarning:inspect
ignore::DeprecationWarning
ignore::pytest.PytestCollectionWarning
ignore::pytest.PytestConfigWarning
12 changes: 12 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pytest
pytest-asyncio
pytest-cov

flake8
black
isort
mypy

pip-audit
safety
bandit
71 changes: 71 additions & 0 deletions run_checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash
set -e

GREEN='\033[0;32m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'

run_security_checks() {
echo -e "${BLUE}Running security checks...${NC}"

chmod +x security_scan.py

./security_scan.py

echo -e "${GREEN}Security checks completed.${NC}"
}

run_lint() {
echo -e "${BLUE}Running linting checks...${NC}"

pip install black ruff

echo -e "${BLUE}Running black (check only)...${NC}"
black --check ticked/ || echo -e "${RED}black check failed${NC}"

echo -e "${BLUE}Running ruff...${NC}"
ruff check ticked/ || echo -e "${RED}ruff check failed${NC}"

echo -e "${GREEN}Linting checks completed.${NC}"
}

run_pytest() {
echo -e "${BLUE}Running pytest...${NC}"

pip install pytest pytest-asyncio pytest-cov
pip install -e .[test]

echo -e "${BLUE}Running database, utils, and system stats tests...${NC}"
python -m pytest tests/test_database.py tests/test_utils.py tests/test_system_stats.py -v

echo -e "${BLUE}Running TUI tests (nest module)...${NC}"
export PYTEST_RUNNING=1
export TERM=xterm-256color
python -m pytest tests/test_nest.py -v

echo -e "${BLUE}Running remaining tests with coverage...${NC}"
python -m pytest --cov=ticked --cov-report=term

echo -e "${GREEN}Tests completed.${NC}"
}

if [ "$1" == "security" ]; then
run_security_checks
elif [ "$1" == "lint" ]; then
run_lint
elif [ "$1" == "pytest" ]; then
run_pytest
elif [ "$1" == "all" ]; then
run_security_checks
run_lint
run_pytest
echo -e "${GREEN}All checks completed successfully!${NC}"
else
echo "Usage: $0 [security|lint|pytest|all]"
echo " security: Run security checks using security_scan.py"
echo " lint: Run linting tools (black, ruff)"
echo " pytest: Run test suite with pytest"
echo " all: Run all checks"
exit 1
fi
Loading