Skip to content
This repository was archived by the owner on Sep 14, 2023. It is now read-only.

Commit 0369989

Browse files
authored
Avoid recognizing symlinked folder as scenarios (#90)
Avoids duplication of scenarios when people create role aliases.
1 parent 4f7c900 commit 0369989

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
- id: black
1111
language_version: python3
1212
- repo: https://github.com/pre-commit/pre-commit-hooks.git
13-
rev: v3.2.0
13+
rev: v3.4.0
1414
hooks:
1515
- id: end-of-file-fixer
1616
- id: trailing-whitespace
@@ -33,7 +33,7 @@ repos:
3333
types: [file, yaml]
3434
entry: yamllint --strict
3535
- repo: https://github.com/codespell-project/codespell.git
36-
rev: v1.17.1
36+
rev: v2.0.0
3737
hooks:
3838
- id: codespell
3939
name: codespell

pytest_molecule/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
if TYPE_CHECKING:
2222
from _pytest.nodes import Node
2323

24+
LOGGER = logging.getLogger(__name__)
25+
2426

2527
def _addoption(group, parser, ini_dest, default, help_msg):
2628
opt = "--" + ini_dest.replace("_", "-")
@@ -123,6 +125,11 @@ def pytest_configure(config):
123125

124126
def pytest_collect_file(parent, path) -> Optional["Node"]:
125127
"""Transform each found molecule.yml into a pytest test."""
128+
129+
# We do not want to recognize paths with symlinks as valid
130+
if os.path.realpath(path) != path:
131+
return None
132+
126133
if path.basename == "molecule.yml":
127134
if hasattr(MoleculeFile, "from_parent"):
128135
return MoleculeFile.from_parent(fspath=path, parent=parent)

0 commit comments

Comments
 (0)