Skip to content

Commit

Permalink
Update integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
guidorice committed Mar 5, 2024
1 parent 6daa612 commit 5be4355
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 32 deletions.
33 changes: 1 addition & 32 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,4 @@ jobs:
run: |
export MODULAR_HOME="/home/runner/.modular"
export PATH="/home/runner/.modular/pkg/packages.modular.com_mojo/bin:$PATH"
mojo --version
# check test collection (this count needs to be updated manually when tests are updated)
pytest | grep "collected 17 items"
# Tests that do not fail
pytest example/tests/mod_b
# Tests that should fail
if pytest example/tests/mod_a ; then
echo "expected pytest exit code 0"
exit 1
fi
# Test should fail because I am passing options for checking warnings
rm -rf ~/.modular/.mojo_cache
if pytest -W error example/tests/test_warning.mojo ; then
echo "expected pytest exit code 0"
exit 1
fi
# Test should not fail because I am not checking for warning
rm -rf ~/.modular/.mojo_cache
pytest example/tests/test_warning.mojo
# Test should fail because debug_assert is enabled
rm -rf ~/.modular/.mojo_cache
if pytest --mojo-assertions example/tests/test_debug_assert.mojo; then
echo "expected pytest exit code 0"
exit 1
fi
make test
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
PHONY: test


test:
mojo --version

# check test collection (this count needs to be updated manually when tests are updated)
pytest | grep "collected 18 items"

# Tests that do not fail
pytest example/tests/mod_b

# Tests that should fail
if pytest example/tests/mod_a ; then
echo "expected pytest non-zero exit code"
exit 1
fi

# Test should fail because I am passing options for checking warnings
rm -rf ~/.modular/.mojo_cache
if pytest -W error example/tests/test_warning.mojo ; then
echo "expected pytest non-zero exit code"
exit 1
fi

# Test should not fail because I am not checking for warning
rm -rf ~/.modular/.mojo_cache
pytest example/tests/test_warning.mojo

# Test should fail because --mojo-assertions is enabled
rm -rf ~/.modular/.mojo_cache
if pytest --mojo-assertions example/tests/test_debug_assert.mojo; then
echo "expected pytest non-zero exit code"
exit 1
fi

# Test should not fail because I am not checking for debug assertions
rm -rf ~/.modular/.mojo_cache
pytest example/tests/test_debug_assert.mojo

0 comments on commit 5be4355

Please sign in to comment.