- Created demo_failing_test.py to demonstrate pre-commit blocking with a failing test. - Added run_tests.py for executing all tests with coverage reporting. - Introduced test.py as a quick test runner for the application, providing coverage reports and user-friendly output.
20 lines
678 B
Python
20 lines
678 B
Python
"""
|
|
Demonstration script to show pre-commit test blocking.
|
|
This creates a temporary failing test to demonstrate the pre-commit behavior.
|
|
"""
|
|
|
|
# Create a simple test file that will fail
|
|
test_content = '''
|
|
def test_that_will_fail():
|
|
"""This test is designed to fail to demonstrate pre-commit blocking."""
|
|
assert False, "This test intentionally fails"
|
|
'''
|
|
|
|
with open("tests/test_demo_fail.py", "w") as f:
|
|
f.write(test_content)
|
|
|
|
print("Created temporary failing test: tests/test_demo_fail.py")
|
|
print("Now try: git add . && git commit -m 'test commit'")
|
|
print("The commit should be blocked by the failing test.")
|
|
print("Remove the file with: rm tests/test_demo_fail.py")
|