Skip to content

Commit

Permalink
Skip test on Symlinks for Windows
Browse files Browse the repository at this point in the history
On Windows only administrator can create symlinks. We will skip this test on windows as one of a low impact.
  • Loading branch information
mknorps committed Dec 21, 2023
1 parent 4f1e2f8 commit 3b5e3b6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/test_dir_traversal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test core functionality of DirectoryTraversal class."""
import os
import platform
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from pathlib import Path
Expand Down Expand Up @@ -272,7 +273,22 @@ class DirectoryTraversalVector(Generic[T]):


@pytest.mark.parametrize(
"vector", [pytest.param(v, id=v.id) for v in directory_traversal_vectors]
"vector",
[
pytest.param(
v,
id=v.id,
marks=pytest.mark.skipif(
platform.system() == "Windows"
and any(
isinstance(entry, (RelativeSymlink, AbsoluteSymlink))
for entry in v.given
),
reason="Symlinks on Windows may be created only by administrators",
),
)
for v in directory_traversal_vectors
],
)
def test_DirectoryTraversal(vector: DirectoryTraversalVector, tmp_path):
for entry in vector.given:
Expand Down

0 comments on commit 3b5e3b6

Please sign in to comment.