File tree Expand file tree Collapse file tree 4 files changed +15
-11
lines changed Expand file tree Collapse file tree 4 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ BuildRequires: python%{python3_pkgversion}-pytest-xdist
25
25
BuildRequires: python%{python3_pkgversion }-libselinux
26
26
BuildRequires: git-core
27
27
%endif
28
+ Requires: git-core
28
29
29
30
30
31
%description
Original file line number Diff line number Diff line change @@ -163,21 +163,18 @@ repos:
163
163
args : [--strict]
164
164
additional_dependencies :
165
165
- ansible-compat>=2.2.6
166
- - ansible-core>=2.14.0
167
166
- black>=22.10.0
167
+ - cryptography
168
168
- filelock
169
+ - jinja2
169
170
- pytest>=7.2.0
170
- - pyyaml
171
171
- rich>=11.0.0
172
172
- ruamel.yaml
173
- - sphinx>=4.4.0
174
- - types-dataclasses
175
- - types-docutils
173
+ - types-PyYAML
176
174
- types-jsonschema>=4.4.2
177
175
- types-pkg_resources
178
- - types-pyyaml>=6.0.4
176
+ - types-setuptools
179
177
- wcmatch
180
- - yamllint
181
178
exclude : >
182
179
(?x)^(
183
180
test/local-content/.*|
Original file line number Diff line number Diff line change @@ -397,8 +397,9 @@ def path_inject() -> None:
397
397
# We do know that finding ansible in PATH does not guarantee that it is
398
398
# functioning or that is in fact the same version that was installed as
399
399
# our dependency, but addressing this would be done by ansible-compat.
400
- if not shutil .which ("ansible" ):
401
- raise RuntimeError ("Failed to find ansible executable in PATH" )
400
+ for cmd in ("ansible" , "git" ):
401
+ if not shutil .which (cmd ):
402
+ raise RuntimeError (f"Failed to find runtime dependency '{ cmd } ' in PATH" )
402
403
403
404
404
405
# Based on Ansible implementation
Original file line number Diff line number Diff line change 1
1
"""Tests related to ansiblelint.__main__ module."""
2
2
import os
3
+ import shutil
3
4
import subprocess
4
5
import sys
5
6
import time
19
20
def test_call_from_outside_venv (expected_warning : bool ) -> None :
20
21
"""Asserts ability to be called w/ or w/o venv activation."""
21
22
env = None
23
+
24
+ git_location = shutil .which ("git" )
25
+ assert git_location
22
26
if expected_warning :
23
- env = {"HOME" : Path .home ()}
27
+ env = {"HOME" : str ( Path .home ()), "PATH" : str ( os . path . dirname ( git_location ) )}
24
28
py_path = os .path .dirname (sys .executable )
25
29
# Passing custom env prevents the process from inheriting PATH or other
26
30
# environment variables from the current process, so we emulate being
27
31
# called from outside the venv.
28
32
proc = subprocess .run (
29
33
[f"{ py_path } /ansible-lint" , "--version" ],
30
- check = True ,
34
+ check = False ,
31
35
capture_output = True ,
32
36
text = True ,
33
37
env = env ,
34
38
)
39
+ assert proc .returncode == 0 , proc
35
40
warning_found = "PATH altered to include" in proc .stderr
36
41
assert warning_found is expected_warning
37
42
You can’t perform that action at this time.
0 commit comments