Skip to content
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
37 changes: 37 additions & 0 deletions .github/workflows/install_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Install from Source Check

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [published]

jobs:
install-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2

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

- name: Install from source
run: |
python -m pip install --upgrade pip
pip install .

- name: Verify installation
run: |
# Change directory to ensure we test the installed package, not the local source
mkdir test_verification
cp tests/verify_install.py test_verification/
cd test_verification
python verify_install.py
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Linting

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install linters
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pycodestyle pydocstyle
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Lint with pycodestyle
run: pycodestyle delayed_assert/
- name: Lint with pydocstyle
run: pydocstyle delayed_assert/
44 changes: 0 additions & 44 deletions .github/workflows/python-package.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-xdist
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run tests (Parallel)
run: |
pytest -n auto
46 changes: 46 additions & 0 deletions tests/verify_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import delayed_assert
import sys

print(f'Successfully imported delayed_assert from {delayed_assert.__file__}')

from delayed_assert import expect, assert_expectations, test_case, set_check_caller

# Verify basic functionality
# We must disable caller check because we are calling expect() from top-level scope
set_check_caller(False)
try:
expect(1 == 1)
assert_expectations()
print('Basic functionality verification passed')
except Exception as e:
print(f'Failed: {e}')
sys.exit(1)

# Re-enable for decorator check (though decorator handles it regardless of flag?
# No, decorator sets context, which expect() checks. Flag only matters if context/stack fails.)
set_check_caller(True)

# Verify @test_case matches
@test_case
def run_check():
expect(1 == 1)

try:
run_check()
assert_expectations()
print('Decorator verification passed')
except Exception as e:
print(f'Decorator Failed: {e}')
sys.exit(1)

# Verify that test files are NOT installed as top-level modules
modules_to_check = ['test_issue_15', 'test_color_toggle', 'test_issue_33']
print('Verifying test modules are not leaking...')
for module in modules_to_check:
try:
__import__(module)
print(f'ERROR: {module} was definitely imported! It should not be installed.')
sys.exit(1)
except ImportError:
pass # This is expected
print('Clean installation verified (no test modules leaked)')