Skip to content

Commit

Permalink
Target make safetest got broken (#273)
Browse files Browse the repository at this point in the history
* Fix `Makefile`.
* Only running tests that don't use real sockets got broken, fixed by adding CIENT SETINFO commands
  • Loading branch information
mindflayer authored Dec 21, 2024
1 parent 9cfad4c commit 895e299
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ types:
test: types
@echo "Running Python tests"
uv pip uninstall pook || true
export VIRTUAL_ENV=.venv; .venv/bin/wait-for-it --service httpbin.local:443 --service localhost:6379 --timeout 5 -- .venv/bin/pytest
.venv/bin/wait-for-it --service httpbin.local:443 --service localhost:6379 --timeout 5 -- .venv/bin/pytest
uv pip install pook && .venv/bin/pytest tests/test_pook.py && uv pip uninstall pook
@echo ""

safetest:
export SKIP_TRUE_REDIS=1; export SKIP_TRUE_HTTP=1; make test
export SKIP_TRUE_REDIS=1; export SKIP_TRUE_HTTP=1; .venv/bin/pytest

publish: clean install-test-requirements
uv run python3 -m build --sdist --wheel .
Expand Down
1 change: 1 addition & 0 deletions tests/test_mocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def test_patch(


@pytest.mark.skipif(not psutil.POSIX, reason="Uses a POSIX-only API to test")
@pytest.mark.skipif('os.getenv("SKIP_TRUE_HTTP", False)')
@pytest.mark.asyncio
async def test_no_dangling_fds():
url = "http://httpbin.local/ip"
Expand Down
4 changes: 3 additions & 1 deletion tests/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,11 @@ def setUp(self):
self.rclient = redis.StrictRedis()

def mocketize_setup(self):
Entry.register_response("CLIENT SETINFO LIB-NAME redis-py", OK)
Entry.register_response(f"CLIENT SETINFO LIB-VER {redis.__version__}", OK)
Entry.register_response("FLUSHDB", OK)
self.rclient.flushdb()
self.assertEqual(len(Mocket.request_list()), 1)
self.assertEqual(len(Mocket.request_list()), 3)
Mocket.reset()

@mocketize
Expand Down

0 comments on commit 895e299

Please sign in to comment.