Skip to content

Commit

Permalink
test: use specific path for premission denied
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro committed Oct 13, 2023
1 parent fea5a12 commit b3fd20f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,16 @@ jobs:
- run: pip install -e .
- run: pip freeze

- if: matrix.os == 'ubuntu'
run: |
mkdir -p ${{ github.workspace }}/protected
touch ${{ github.workspace }}/protected/test
sudo chown -R root:root ${{ github.workspace }}/protected
sudo chmod 700 ${{ github.workspace }}/protected
- run: make test
env:
WATCHFILES_TEST_PERMISSION_DENIED_PATH: ${{ github.workspace }}/protected

- run: coverage xml

Expand Down
7 changes: 5 additions & 2 deletions tests/test_rust_notify.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
from pathlib import Path
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -311,10 +312,12 @@ def test_polling_repr(test_dir: Path):

@skip_unless_linux
def test_ignore_permission_denied():
RustNotify(['/'], False, False, 0, True, True)
path = os.getenv('WATCHFILES_TEST_PERMISSION_DENIED_PATH') or '/'

RustNotify([path], False, False, 0, True, True)

with pytest.raises(PermissionError):
RustNotify(['/'], False, False, 0, True, False)
RustNotify([path], False, False, 0, True, False)


@pytest.mark.parametrize(
Expand Down

0 comments on commit b3fd20f

Please sign in to comment.