Merge pull request #58356 from s0undt3ch/hotfix/pytest-migration-1

[PyTest Migration] PyTest Fixes/Cleanup before migration
This commit is contained in:
Pedro Algarvio 2020-09-02 13:58:24 +01:00 committed by GitHub
commit ef35eecbd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 225 additions and 237 deletions

View file

@ -1,9 +1,7 @@
mock >= 3.0.0
# PyTest
pytest >= 5.4.2; sys_platform != "win32"
# https://github.com/pytest-dev/pytest/issues/6964#issuecomment-632727439
pytest >=4.6.9,<4.7; sys_platform == "win32"
pytest >= 6.0.1
pytest-salt
pytest-salt-factories >= 0.10.7
pytest-salt-factories >= 0.11.3
pytest-tempdir >= 2019.10.12
pytest-helpers-namespace >= 2019.1.8

View file

@ -47,6 +47,7 @@ google-auth==1.6.3 # via kubernetes
idna==2.8
importlib-metadata==0.23 # via importlib-resources, pluggy, pytest, virtualenv
importlib-resources==1.3.1 # via virtualenv
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22
jaraco.functools==2.0 # via tempora
jinja2==2.10.1
@ -77,7 +78,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.1 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.8
@ -89,10 +90,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0
python-etcd==0.4.5
python-gnupg==0.4.4
@ -123,7 +124,6 @@ vcert==0.7.3
virtualenv==20.0.20
vultr==1.0.1
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -44,6 +44,7 @@ hgtools==8.1.1
idna==2.8 # via requests
importlib-metadata==0.23 # via importlib-resources, pluggy, pytest, virtualenv
importlib-resources==1.5.0 # via virtualenv
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22 # via kubernetes
jaraco.functools==2.0 # via tempora
jinja2==2.10.1
@ -75,7 +76,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via pyasn1-modules, rsa
@ -89,10 +90,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0 # via botocore, croniter, kubernetes, moto, vcert
python-etcd==0.4.5
python-gnupg==0.4.4
@ -123,7 +124,6 @@ urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
vcert==0.7.3
virtualenv==20.0.20
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -129,6 +129,7 @@ hgtools==8.1.1
idna==2.8 # via requests
importlib-metadata==0.23 # via importlib-resources, pluggy, pytest, virtualenv
importlib-resources==1.5.0 # via virtualenv
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22 # via kubernetes
isodate==0.6.0 # via msrest
jaraco.functools==2.0 # via tempora
@ -165,7 +166,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via pyasn1-modules, rsa
@ -180,10 +181,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0 # via adal, azure-cosmosdb-table, azure-storage-common, botocore, croniter, kubernetes, moto, vcert
python-etcd==0.4.5
python-gnupg==0.4.4
@ -215,7 +216,6 @@ urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
vcert==0.7.3
virtualenv==20.0.20
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -44,6 +44,7 @@ google-auth==1.6.3 # via kubernetes
idna==2.8
importlib-metadata==0.23 # via importlib-resources, pluggy, pytest, virtualenv
importlib-resources==1.5.0 # via virtualenv
iniconfig==1.0.1 # via pytest
ioloop==0.1a0
ipaddress==1.0.22
jaraco.functools==2.0 # via tempora
@ -68,7 +69,7 @@ pathlib2==2.3.3 # via pytest
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5
@ -82,10 +83,10 @@ pymysql==0.9.3
pyopenssl==19.0.0
pyparsing==2.4.5 # via packaging
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==4.6.9 ; sys_platform == "win32"
pytest==6.0.1
python-dateutil==2.8.0
python-etcd==0.4.5
python-gnupg==0.4.4
@ -104,7 +105,7 @@ s3transfer==0.3.3 # via boto3
salttesting==2017.6.1
sed==0.3.1
setproctitle==1.1.10
six==1.12.0 # via cassandra-driver, cheroot, cherrypy, cryptography, docker, docker-pycreds, geomet, google-auth, kubernetes, mock, more-itertools, moto, packaging, pathlib2, pygit2, pyopenssl, pytest, python-dateutil, python-jose, pyvmomi, responses, salttesting, tempora, virtualenv, websocket-client
six==1.12.0 # via cassandra-driver, cheroot, cherrypy, cryptography, docker, docker-pycreds, geomet, google-auth, kubernetes, mock, more-itertools, moto, packaging, pathlib2, pygit2, pyopenssl, python-dateutil, python-jose, pyvmomi, responses, salttesting, tempora, virtualenv, websocket-client
smmap2==2.0.5
strict-rfc3339==0.7
tempora==1.14.1 # via portend
@ -112,7 +113,6 @@ timelib==0.2.4
toml==0.10.0
urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
virtualenv==20.0.20
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wheel==0.33.4

View file

@ -49,6 +49,7 @@ google-auth==1.6.3 # via kubernetes
idna==2.8
importlib-metadata==0.23 # via importlib-resources, pluggy, pytest, virtualenv
importlib-resources==1.3.1 # via virtualenv
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22
jaraco.functools==2.0 # via tempora
jinja2==2.10.1
@ -81,7 +82,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.1 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.8
@ -94,10 +95,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0
python-etcd==0.4.5
python-gnupg==0.4.4
@ -128,7 +129,6 @@ vcert==0.7.3
virtualenv==20.0.20
vultr==1.0.1
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -46,6 +46,7 @@ hgtools==8.1.1
idna==2.8 # via requests
importlib-metadata==0.23 # via importlib-resources, pluggy, pytest, virtualenv
importlib-resources==1.5.0 # via virtualenv
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22 # via kubernetes
jaraco.functools==2.0 # via tempora
jinja2==2.10.1
@ -79,7 +80,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via pyasn1-modules, rsa
@ -94,10 +95,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0 # via botocore, croniter, kubernetes, moto, vcert
python-etcd==0.4.5
python-gnupg==0.4.4
@ -128,7 +129,6 @@ urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
vcert==0.7.3
virtualenv==20.0.20
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -131,6 +131,7 @@ hgtools==8.1.1
idna==2.8 # via requests
importlib-metadata==0.23 # via importlib-resources, pluggy, pytest, virtualenv
importlib-resources==1.5.0 # via virtualenv
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22 # via kubernetes
isodate==0.6.0 # via msrest
jaraco.functools==2.0 # via tempora
@ -168,7 +169,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via pyasn1-modules, rsa
@ -184,10 +185,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0 # via adal, azure-cosmosdb-table, azure-storage-common, botocore, croniter, kubernetes, moto, vcert
python-etcd==0.4.5
python-gnupg==0.4.4
@ -219,7 +220,6 @@ urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
vcert==0.7.3
virtualenv==20.0.20
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -44,6 +44,7 @@ google-auth==1.6.3 # via kubernetes
idna==2.8
importlib-metadata==0.23 # via importlib-resources, pluggy, pytest, virtualenv
importlib-resources==1.5.0 # via virtualenv
iniconfig==1.0.1 # via pytest
ioloop==0.1a0
ipaddress==1.0.22
jaraco.functools==2.0 # via tempora
@ -67,7 +68,7 @@ patch==1.16
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5
@ -81,10 +82,10 @@ pymysql==0.9.3
pyopenssl==19.0.0
pyparsing==2.4.5 # via packaging
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==4.6.9 ; sys_platform == "win32"
pytest==6.0.1
python-dateutil==2.8.0
python-etcd==0.4.5
python-gnupg==0.4.4
@ -103,7 +104,7 @@ s3transfer==0.3.3 # via boto3
salttesting==2017.6.1
sed==0.3.1
setproctitle==1.1.10
six==1.12.0 # via cassandra-driver, cheroot, cherrypy, cryptography, docker, docker-pycreds, geomet, google-auth, kubernetes, mock, more-itertools, moto, packaging, pygit2, pyopenssl, pytest, python-dateutil, python-jose, pyvmomi, responses, salttesting, tempora, virtualenv, websocket-client
six==1.12.0 # via cassandra-driver, cheroot, cherrypy, cryptography, docker, docker-pycreds, geomet, google-auth, kubernetes, mock, more-itertools, moto, packaging, pygit2, pyopenssl, python-dateutil, python-jose, pyvmomi, responses, salttesting, tempora, virtualenv, websocket-client
smmap2==2.0.5
strict-rfc3339==0.7
tempora==1.14.1 # via portend
@ -111,7 +112,6 @@ timelib==0.2.4
toml==0.10.0
urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
virtualenv==20.0.20
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wheel==0.33.4

View file

@ -47,6 +47,7 @@ gitpython==2.1.15
google-auth==1.6.3 # via kubernetes
idna==2.8
importlib-metadata==0.23 # via pluggy, pytest, virtualenv
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22
jaraco.functools==2.0 # via tempora
jinja2==2.10.1
@ -79,7 +80,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.1 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.8
@ -92,10 +93,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0
python-etcd==0.4.5
python-gnupg==0.4.4
@ -126,7 +127,6 @@ vcert==0.7.3
virtualenv==20.0.20
vultr==1.0.1
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -45,6 +45,7 @@ google-auth==1.6.3 # via kubernetes
hgtools==8.1.1
idna==2.8 # via requests
importlib-metadata==0.23 # via pluggy, pytest, virtualenv
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22 # via kubernetes
jaraco.functools==2.0 # via tempora
jinja2==2.10.1
@ -78,7 +79,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via pyasn1-modules, rsa
@ -93,10 +94,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0 # via botocore, croniter, kubernetes, moto, vcert
python-etcd==0.4.5
python-gnupg==0.4.4
@ -127,7 +128,6 @@ urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
vcert==0.7.3
virtualenv==20.0.20
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -130,6 +130,7 @@ google-auth==1.6.3 # via kubernetes
hgtools==8.1.1
idna==2.8 # via requests
importlib-metadata==0.23 # via pluggy, pytest, virtualenv
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22 # via kubernetes
isodate==0.6.0 # via msrest
jaraco.functools==2.0 # via tempora
@ -167,7 +168,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via pyasn1-modules, rsa
@ -183,10 +184,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0 # via adal, azure-cosmosdb-table, azure-storage-common, botocore, croniter, kubernetes, moto, vcert
python-etcd==0.4.5
python-gnupg==0.4.4
@ -218,7 +219,6 @@ urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
vcert==0.7.3
virtualenv==20.0.20
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -42,6 +42,7 @@ gitpython==2.1.10
google-auth==1.6.3 # via kubernetes
idna==2.8
importlib-metadata==0.23 # via pluggy, pytest, virtualenv
iniconfig==1.0.1 # via pytest
ioloop==0.1a0
ipaddress==1.0.22
jaraco.functools==2.0 # via tempora
@ -65,7 +66,7 @@ patch==1.16
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5
@ -79,10 +80,10 @@ pymysql==0.9.3
pyopenssl==19.0.0
pyparsing==2.4.5 # via packaging
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==4.6.9 ; sys_platform == "win32"
pytest==6.0.1
python-dateutil==2.8.0
python-etcd==0.4.5
python-gnupg==0.4.4
@ -101,7 +102,7 @@ s3transfer==0.3.3 # via boto3
salttesting==2017.6.1
sed==0.3.1
setproctitle==1.1.10
six==1.12.0 # via cassandra-driver, cheroot, cherrypy, cryptography, docker, docker-pycreds, geomet, google-auth, kubernetes, mock, more-itertools, moto, packaging, pygit2, pyopenssl, pytest, python-dateutil, python-jose, pyvmomi, responses, salttesting, tempora, virtualenv, websocket-client
six==1.12.0 # via cassandra-driver, cheroot, cherrypy, cryptography, docker, docker-pycreds, geomet, google-auth, kubernetes, mock, more-itertools, moto, packaging, pygit2, pyopenssl, python-dateutil, python-jose, pyvmomi, responses, salttesting, tempora, virtualenv, websocket-client
smmap2==2.0.5
strict-rfc3339==0.7
tempora==1.14.1 # via portend
@ -109,7 +110,6 @@ timelib==0.2.4
toml==0.10.0
urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
virtualenv==20.0.20
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wheel==0.33.4

View file

@ -46,6 +46,7 @@ gitdb2==2.0.5 # via gitpython
gitpython==2.1.15
google-auth==1.6.3 # via kubernetes
idna==2.8
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22
jaraco.functools==2.0 # via tempora
jinja2==2.10.1
@ -78,7 +79,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.1 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.8
@ -91,10 +92,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0
python-etcd==0.4.5
python-gnupg==0.4.4
@ -125,7 +126,6 @@ vcert==0.7.3
virtualenv==20.0.20
vultr==1.0.1
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -44,6 +44,7 @@ gitpython==2.1.11
google-auth==1.6.3 # via kubernetes
hgtools==8.1.1
idna==2.8 # via requests
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22 # via kubernetes
jaraco.functools==2.0 # via tempora
jinja2==2.10.1
@ -77,7 +78,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.1
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via pyasn1-modules, rsa
@ -92,10 +93,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0 # via botocore, croniter, kubernetes, moto, vcert
python-etcd==0.4.5
python-gnupg==0.4.4
@ -126,7 +127,6 @@ urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
vcert==0.7.3
virtualenv==20.0.20
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -130,6 +130,7 @@ gitpython==2.1.11
google-auth==1.6.3 # via kubernetes
hgtools==8.1.1
idna==2.8 # via requests
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22 # via kubernetes
isodate==0.6.0 # via msrest
jaraco.functools==2.0 # via tempora
@ -167,7 +168,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.1
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via pyasn1-modules, rsa
@ -183,10 +184,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0 # via adal, azure-cosmosdb-table, azure-storage-common, botocore, croniter, kubernetes, moto, vcert
python-etcd==0.4.5
python-gnupg==0.4.4
@ -218,7 +219,6 @@ urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
vcert==0.7.3
virtualenv==20.0.20
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -46,6 +46,7 @@ gitdb2==2.0.5 # via gitpython
gitpython==2.1.15
google-auth==1.6.3 # via kubernetes
idna==2.8
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22
jaraco.functools==2.0 # via tempora
jinja2==2.10.1
@ -78,7 +79,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.1 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.7
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.8
@ -91,10 +92,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0
python-etcd==0.4.5
python-gnupg==0.4.4
@ -126,7 +127,6 @@ vcert==0.7.3
virtualenv==20.0.20
vultr==1.0.1
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -44,6 +44,7 @@ gitpython==2.1.11
google-auth==1.6.3 # via kubernetes
hgtools==8.1.1
idna==2.8 # via requests
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22 # via kubernetes
jaraco.functools==2.0 # via tempora
jinja2==2.10.1
@ -77,7 +78,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.1
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via pyasn1-modules, rsa
@ -92,10 +93,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0 # via botocore, croniter, kubernetes, moto, vcert
python-etcd==0.4.5
python-gnupg==0.4.4
@ -126,7 +127,6 @@ urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
vcert==0.7.3
virtualenv==20.0.20
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -130,6 +130,7 @@ gitpython==2.1.11
google-auth==1.6.3 # via kubernetes
hgtools==8.1.1
idna==2.8 # via requests
iniconfig==1.0.1 # via pytest
ipaddress==1.0.22 # via kubernetes
isodate==0.6.0 # via msrest
jaraco.functools==2.0 # via tempora
@ -167,7 +168,7 @@ pathtools==0.1.2 # via watchdog
pluggy==0.13.0 # via pytest
portend==2.4 # via cherrypy
psutil==5.6.1
py==1.8.0 # via pytest
py==1.9.0 # via pytest
pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via pyasn1-modules, rsa
@ -183,10 +184,10 @@ pyopenssl==19.0.0
pyparsing==2.4.5 # via junos-eznc, packaging
pyserial==3.4 # via junos-eznc, netmiko
pytest-helpers-namespace==2019.1.8
pytest-salt-factories==0.10.7
pytest-salt-factories==0.11.3
pytest-salt==2020.1.27
pytest-tempdir==2019.10.12
pytest==5.4.2 ; sys_platform != "win32"
pytest==6.0.1
python-dateutil==2.8.0 # via adal, azure-cosmosdb-table, azure-storage-common, botocore, croniter, kubernetes, moto, vcert
python-etcd==0.4.5
python-gnupg==0.4.4
@ -218,7 +219,6 @@ urllib3==1.24.2 # via botocore, kubernetes, python-etcd, requests
vcert==0.7.3
virtualenv==20.0.20
watchdog==0.9.0
wcwidth==0.1.7 # via pytest
websocket-client==0.40.0 # via docker, kubernetes
werkzeug==0.15.6 # via moto
wrapt==1.11.1 # via aws-xray-sdk

View file

@ -17,6 +17,7 @@ import pprint
import re
import sys
from functools import partial, wraps
from unittest import TestCase # pylint: disable=blacklisted-module
import _pytest.logging
import _pytest.skipping
@ -31,15 +32,16 @@ import salt.utils.path
import salt.utils.platform
import salt.utils.win_functions
import saltfactories.utils.compat
from _pytest.mark.evaluate import MarkEvaluator
from salt.serializers import yaml
from tests.support.helpers import PRE_PYTEST_SKIP_OR_NOT, PRE_PYTEST_SKIP_REASON
from tests.support.pytest.fixtures import * # pylint: disable=unused-wildcard-import
from tests.support.pytest.helpers import * # pylint: disable=unused-wildcard-import
from tests.support.runtests import RUNTIME_VARS
from tests.support.saltfactories_compat import LogServer
from tests.support.sminion import check_required_sminion_attributes, create_sminion
TESTS_DIR = pathlib.Path(__file__).resolve().parent
PYTESTS_DIR = TESTS_DIR / "pytests"
CODE_DIR = TESTS_DIR.parent
# Change to code checkout directory
@ -327,6 +329,28 @@ def pytest_report_header():
return "max open files; soft: {}; hard: {}".format(soft, hard)
def pytest_itemcollected(item):
"""We just collected a test item."""
try:
pathlib.Path(item.fspath.strpath).resolve().relative_to(PYTESTS_DIR)
# Test is under tests/pytests
if item.cls and issubclass(item.cls, TestCase):
pytest.fail(
"The tests under {0!r} MUST NOT use unittest's TestCase class or a subclass of it. "
"Please move {1!r} outside of {0!r}".format(
str(PYTESTS_DIR.relative_to(CODE_DIR)), item.nodeid
)
)
except ValueError:
# Test is not under tests/pytests
if not item.cls or (item.cls and not issubclass(item.cls, TestCase)):
pytest.fail(
"The test {!r} appears to be written for pytest but it's not under {!r}. Please move it there.".format(
item.nodeid, str(PYTESTS_DIR.relative_to(CODE_DIR)), pytrace=False
)
)
@pytest.hookimpl(hookwrapper=True, trylast=True)
def pytest_collection_modifyitems(config, items):
"""
@ -348,13 +372,8 @@ def pytest_collection_modifyitems(config, items):
if fixture not in item._fixtureinfo.name2fixturedefs:
continue
for fixturedef in item._fixtureinfo.name2fixturedefs[fixture]:
if fixturedef.scope in ("function", "class", "module"):
if fixturedef.scope != "package":
continue
try:
node_ids = fixturedef.node_ids
except AttributeError:
node_ids = fixturedef.node_ids = set()
node_ids.add(item.nodeid)
try:
fixturedef.finish.__wrapped__
except AttributeError:
@ -362,25 +381,40 @@ def pytest_collection_modifyitems(config, items):
def wrapper(func, fixturedef):
@wraps(func)
def wrapped(self, request):
def wrapped(self, request, nextitem=False):
try:
return self._finished
except AttributeError:
if self.node_ids:
if (
not request.session.shouldfail
and not request.session.shouldstop
):
log.debug(
"%s is still going to be used, not terminating it. "
"Still in use on:\n%s",
self,
pprint.pformat(list(self.node_ids)),
)
return
if nextitem:
fpath = pathlib.Path(self.baseid).resolve()
tpath = pathlib.Path(
nextitem.fspath.strpath
).resolve()
try:
tpath.relative_to(fpath)
# The test module is within the same package that the fixture is
if (
not request.session.shouldfail
and not request.session.shouldstop
):
log.debug(
"The next test item is still under the fixture package path. "
"Not terminating %s",
self,
)
return
except ValueError:
pass
log.debug("Finish called on %s", self)
try:
return func(request)
except BaseException as exc: # pylint: disable=broad-except
pytest.fail(
"Failed to run finish() on {}: {}".format(
fixturedef, exc
),
pytrace=True,
)
finally:
self._finished = True
@ -417,7 +451,7 @@ def pytest_runtest_protocol(item, nextitem):
if fixture not in item._fixtureinfo.name2fixturedefs:
continue
for fixturedef in reversed(item._fixtureinfo.name2fixturedefs[fixture]):
if fixturedef.scope in ("function", "class", "module"):
if fixturedef.scope != "package":
continue
used_fixture_defs.append(fixturedef)
try:
@ -425,31 +459,11 @@ def pytest_runtest_protocol(item, nextitem):
yield
finally:
for fixturedef in used_fixture_defs:
if item.nodeid in fixturedef.node_ids:
fixturedef.node_ids.remove(item.nodeid)
if not fixturedef.node_ids:
# This fixture is not used in any more test functions
fixturedef.finish(request)
fixturedef.finish(request, nextitem=nextitem)
del request
del used_fixture_defs
def pytest_runtest_teardown(item, nextitem):
"""
called after ``pytest_runtest_call``.
:arg nextitem: the scheduled-to-be-next test item (None if no further
test item is scheduled). This argument can be used to
perform exact teardowns, i.e. calling just enough finalizers
so that nextitem only needs to call setup-functions.
"""
# PyTest doesn't reset the capturing log handler when done with it.
# Reset it to free used memory and python objects
# We currently have PyTest's log_print setting set to false, if it was
# set to true, the call bellow would make PyTest not print any logs at all.
item.catch_log_handler.reset()
@pytest.hookimpl(tryfirst=True)
def pytest_sessionstart(session):
log_server = session.config.pluginmanager.get_plugin(
@ -482,7 +496,7 @@ def pytest_runtest_setup(item):
"""
Fixtures injection based on markers or test skips based on CLI arguments
"""
integration_utils_tests_path = str(CODE_DIR / "tests" / "integration" / "utils")
integration_utils_tests_path = str(TESTS_DIR / "integration" / "utils")
if (
str(item.fspath).startswith(integration_utils_tests_path)
and PRE_PYTEST_SKIP_OR_NOT is True
@ -546,7 +560,11 @@ def pytest_runtest_setup(item):
)
if salt.utils.platform.is_windows():
if not item.fspath.fnmatch(str(CODE_DIR / "tests" / "unit" / "*")):
unit_tests_paths = (
str(TESTS_DIR / "unit"),
str(PYTESTS_DIR / "unit"),
)
if not str(pathlib.Path(item.fspath).resolve()).startswith(unit_tests_paths):
# Unit tests are whitelisted on windows by default, so, we're only
# after all other tests
windows_whitelisted_marker = item.get_closest_marker("windows_whitelisted")
@ -649,13 +667,13 @@ def from_filenames_collection_modifyitems(config, items):
return
test_categories_paths = (
(CODE_DIR / "tests" / "integration").relative_to(CODE_DIR),
(CODE_DIR / "tests" / "multimaster").relative_to(CODE_DIR),
(CODE_DIR / "tests" / "unit").relative_to(CODE_DIR),
(CODE_DIR / "tests" / "pytests" / "e2e").relative_to(CODE_DIR),
(CODE_DIR / "tests" / "pytests" / "functional").relative_to(CODE_DIR),
(CODE_DIR / "tests" / "pytests" / "integration").relative_to(CODE_DIR),
(CODE_DIR / "tests" / "pytests" / "unit").relative_to(CODE_DIR),
(TESTS_DIR / "integration").relative_to(CODE_DIR),
(TESTS_DIR / "multimaster").relative_to(CODE_DIR),
(TESTS_DIR / "unit").relative_to(CODE_DIR),
(PYTESTS_DIR / "e2e").relative_to(CODE_DIR),
(PYTESTS_DIR / "functional").relative_to(CODE_DIR),
(PYTESTS_DIR / "integration").relative_to(CODE_DIR),
(PYTESTS_DIR / "unit").relative_to(CODE_DIR),
)
test_module_paths = set()
@ -673,9 +691,7 @@ def from_filenames_collection_modifyitems(config, items):
continue
from_filenames_listing.add(path)
filename_map = yaml.deserialize(
(CODE_DIR / "tests" / "filename_map.yml").read_text()
)
filename_map = yaml.deserialize((TESTS_DIR / "filename_map.yml").read_text())
# Let's add the match all rule
for rule, matches in filename_map.items():
if rule == "*":
@ -749,23 +765,6 @@ def from_filenames_collection_modifyitems(config, items):
# <---- From Filenames Test Selection --------------------------------------------------------------------------------
# ----- Custom Grains Mark Evaluator -------------------------------------------------------------------------------->
class GrainsMarkEvaluator(MarkEvaluator):
_cached_grains = None
def _getglobals(self):
item_globals = super()._getglobals()
if GrainsMarkEvaluator._cached_grains is None:
sminion = create_sminion()
GrainsMarkEvaluator._cached_grains = sminion.opts["grains"].copy()
item_globals["grains"] = GrainsMarkEvaluator._cached_grains.copy()
return item_globals
# Patch PyTest's skipping MarkEvaluator to use our GrainsMarkEvaluator
_pytest.skipping.MarkEvaluator = GrainsMarkEvaluator
# <---- Custom Grains Mark Evaluator ---------------------------------------------------------------------------------
# ----- Custom Fixtures --------------------------------------------------------------------------------------------->
@pytest.fixture(scope="session")

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
tests.integration.conftest
~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -7,12 +6,10 @@
"""
# pylint: disable=unused-argument,redefined-outer-name
from __future__ import absolute_import, unicode_literals
import logging
import pytest
from tests.support.pytest.fixtures import * # pylint: disable=unused-wildcard-import
log = logging.getLogger(__name__)
@ -33,12 +30,12 @@ log = logging.getLogger(__name__)
@pytest.fixture(scope="package")
def salt_master(request, salt_factories):
def salt_master(request, salt_factories, salt_master_config):
return salt_factories.spawn_master(request, "master")
@pytest.fixture(scope="package")
def salt_minion(request, salt_factories, salt_master):
def salt_minion(request, salt_factories, salt_master, salt_minion_config):
proc = salt_factories.spawn_minion(request, "minion", master_id="master")
# Sync All
salt_call_cli = salt_factories.get_salt_call_cli("minion")
@ -48,7 +45,7 @@ def salt_minion(request, salt_factories, salt_master):
@pytest.fixture(scope="package")
def salt_sub_minion(request, salt_factories, salt_master):
def salt_sub_minion(request, salt_factories, salt_master, salt_sub_minion_config):
proc = salt_factories.spawn_minion(request, "sub_minion", master_id="master")
# Sync All
salt_call_cli = salt_factories.get_salt_call_cli("sub_minion")

View file

@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
"""
Simple Smoke Tests for Connected Proxy Minion
"""
from __future__ import absolute_import, print_function, unicode_literals
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import slowTest
from tests.support.helpers import PRE_PYTEST_SKIP_REASON, slowTest
class ProxyMinionSimpleTestCase(ModuleCase):
@ -77,12 +76,14 @@ class ProxyMinionSimpleTestCase(ModuleCase):
self.assertEqual(ret["kernel"], "proxy")
self.assertEqual(ret["kernelrelease"], "proxy")
@pytest.mark.skip_on_darwin(reason=PRE_PYTEST_SKIP_REASON)
def test_state_apply(self):
ret = self.run_function("state.apply", ["core"], minion_tgt="proxytest")
for key, value in ret.items():
self.assertTrue(value["result"])
@slowTest
@pytest.mark.skip_on_darwin(reason=PRE_PYTEST_SKIP_REASON)
def test_state_highstate(self):
ret = self.run_function("state.highstate", minion_tgt="proxytest")
for key, value in ret.items():

View file

@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
"""
tests.multimaster.conftest
~~~~~~~~~~~~~~~~~~~~~~~~~~
Multimaster PyTest prep routines
"""
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
@ -15,7 +13,6 @@ import pytest
import salt.utils.files
from salt.serializers import yaml
from salt.utils.immutabletypes import freeze
from tests.support.pytest.fixtures import * # pylint: disable=unused-wildcard-import
from tests.support.runtests import RUNTIME_VARS
log = logging.getLogger(__name__)
@ -30,6 +27,7 @@ def salt_mm_master_config(request, salt_factories):
config_defaults = yaml.deserialize(rfh.read())
config_defaults["root_dir"] = root_dir.strpath
config_defaults["transport"] = request.config.getoption("--transport")
config_overrides = {
"file_roots": {
@ -97,6 +95,7 @@ def salt_mm_sub_master_config(request, salt_factories, salt_mm_master):
root_dir = salt_factories._get_root_dir_for_daemon("mm-master")
config_defaults["root_dir"] = root_dir.strpath
config_defaults["transport"] = request.config.getoption("--transport")
config_overrides = {
"file_roots": {

View file

@ -1,41 +0,0 @@
# -*- coding: utf-8 -*-
"""
tests.pytests.conftest
~~~~~~~~~~~~~~~~~~~~~~
"""
import pathlib
import pytest
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import TestCase
PYTESTS_SUITE_PATH = pathlib.Path(__file__).parent
@pytest.hookimpl(hookwrapper=True, trylast=True)
def pytest_collection_modifyitems(config, items):
"""
called after collection has been performed, may filter or re-order
the items in-place.
:param _pytest.main.Session session: the pytest session object
:param _pytest.config.Config config: pytest config object
:param List[_pytest.nodes.Item] items: list of item objects
"""
# Let PyTest or other plugins handle the initial collection
yield
# Check each collected item that's under this package to ensure that none is using TestCase as the base class
for item in items:
if not str(item.fspath).startswith(str(PYTESTS_SUITE_PATH)):
continue
if not item.cls:
# The test item is not part of a class
continue
if issubclass(item.cls, TestCase):
raise RuntimeError(
"The tests under {} MUST NOT use unittest's TestCase class or a subclass of it.".format(
pathlib.Path(str(item.fspath)).relative_to(RUNTIME_VARS.CODE_DIR)
)
)

View file

@ -2,5 +2,50 @@ import pytest
@pytest.fixture(scope="package")
def salt_master(request, salt_factories):
def salt_master(request, salt_factories, salt_master_config):
return salt_factories.spawn_master(request, "master")
@pytest.fixture(scope="package")
def salt_minion(request, salt_factories, salt_master, salt_minion_config):
proc = salt_factories.spawn_minion(request, "minion", master_id="master")
# Sync All
salt_call_cli = salt_factories.get_salt_call_cli("minion")
ret = salt_call_cli.run("saltutil.sync_all", _timeout=120)
assert ret.exitcode == 0, ret
return proc
@pytest.fixture(scope="package")
def salt_sub_minion(request, salt_factories, salt_master, salt_sub_minion_config):
proc = salt_factories.spawn_minion(request, "sub_minion", master_id="master")
# Sync All
salt_call_cli = salt_factories.get_salt_call_cli("sub_minion")
ret = salt_call_cli.run("saltutil.sync_all", _timeout=120)
assert ret.exitcode == 0, ret
return proc
@pytest.fixture(scope="package")
def salt_cli(salt_factories, salt_minion, salt_master):
return salt_factories.get_salt_cli(salt_master.config["id"])
@pytest.fixture(scope="package")
def salt_cp_cli(salt_factories, salt_minion, salt_master):
return salt_factories.get_salt_cp_cli(salt_master.config["id"])
@pytest.fixture(scope="package")
def salt_key_cli(salt_factories, salt_minion, salt_master):
return salt_factories.get_salt_key_cli(salt_master.config["id"])
@pytest.fixture(scope="package")
def salt_run_cli(salt_factories, salt_minion, salt_master):
return salt_factories.get_salt_run_cli(salt_master.config["id"])
@pytest.fixture(scope="package")
def salt_call_cli(salt_factories, salt_minion, salt_master):
return salt_factories.get_salt_call_cli(salt_minion.config["id"])

View file

@ -7,6 +7,7 @@ import copy
import errno
import logging
import os
import pathlib
import pprint
import shutil
import tempfile
@ -226,7 +227,7 @@ class SSHDMixin(SaltClientMixin, SaltReturnAssertsMixin):
cls.sshd_proc = start_daemon(
cls.sshd_bin,
SshdDaemon,
config_dir=cls.sshd_config_dir,
config_dir=pathlib.Path(cls.sshd_config_dir),
serve_port=cls.sshd_port,
)
log.info("%s: sshd started", cls.__name__)

View file

@ -212,7 +212,7 @@ def salt_master_config(request, salt_factories, salt_syndic_master_config):
{"salt/test/reactor": [os.path.join(RUNTIME_VARS.FILES, "reactor-test.sls")]}
]
config_overrides = {"interface": "0.0.0.0"}
config_overrides = {}
ext_pillar = []
if salt.utils.platform.is_windows():
ext_pillar.append(

View file

@ -1,3 +0,0 @@
# -*- coding: utf-8 -*-
from tests.support.pytest.fixtures import * # pylint: disable=unused-wildcard-import

View file

@ -1,26 +1,20 @@
# -*- coding: utf-8 -*-
"""
Tests for the salt fileclient
"""
# Import Python libs
from __future__ import absolute_import
import errno
import logging
import os
import shutil
# Import Salt libs
import salt.utils.files
from salt import fileclient
from salt.ext import six
from salt.ext.six.moves import range
from tests.integration import AdaptedConfigurationTestCaseMixin
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mixins import (
AdaptedConfigurationTestCaseMixin,
LoaderModuleMockMixin,
)
from tests.support.mock import MagicMock, Mock, patch
# Import Salt Testing libs
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import TestCase
@ -39,7 +33,7 @@ class FileclientTestCase(TestCase):
def _fake_makedir(self, num=errno.EEXIST):
def _side_effect(*args, **kwargs):
raise OSError(num, "Errno {0}".format(num))
raise OSError(num, "Errno {}".format(num))
return Mock(side_effect=_side_effect)
@ -99,7 +93,7 @@ SUBDIR_FILES = ("foo.txt", "bar.txt", "baz.txt")
def _get_file_roots(fs_root):
return dict([(x, [os.path.join(fs_root, x)]) for x in SALTENVS])
return {x: [os.path.join(fs_root, x)] for x in SALTENVS}
class FileClientTest(
@ -201,7 +195,7 @@ class FileclientCacheTest(
path = os.path.join(saltenv_root, "foo.txt")
with salt.utils.files.fopen(path, "w") as fp_:
fp_.write("This is a test file in the '{0}' saltenv.\n".format(saltenv))
fp_.write("This is a test file in the '{}' saltenv.\n".format(saltenv))
subdir_abspath = os.path.join(saltenv_root, SUBDIR)
os.makedirs(subdir_abspath)
@ -209,8 +203,8 @@ class FileclientCacheTest(
path = os.path.join(subdir_abspath, subdir_file)
with salt.utils.files.fopen(path, "w") as fp_:
fp_.write(
"This is file '{0}' in subdir '{1} from saltenv "
"'{2}'".format(subdir_file, SUBDIR, saltenv)
"This is file '{}' in subdir '{} from saltenv "
"'{}'".format(subdir_file, SUBDIR, saltenv)
)
# Create the CACHE_ROOT
@ -220,16 +214,14 @@ class FileclientCacheTest(
"""
Ensure entire directory is cached to correct location
"""
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
patched_opts = {x: y for x, y in self.minion_opts.items()}
patched_opts.update(self.MOCKED_OPTS)
with patch.dict(fileclient.__opts__, patched_opts):
client = fileclient.get_file_client(fileclient.__opts__, pillar=False)
for saltenv in SALTENVS:
self.assertTrue(
client.cache_dir(
"salt://{0}".format(SUBDIR), saltenv, cachedir=None
)
client.cache_dir("salt://{}".format(SUBDIR), saltenv, cachedir=None)
)
for subdir_file in SUBDIR_FILES:
cache_loc = os.path.join(
@ -259,7 +251,7 @@ class FileclientCacheTest(
Ensure entire directory is cached to correct location when an alternate
cachedir is specified and that cachedir is an absolute path
"""
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
patched_opts = {x: y for x, y in self.minion_opts.items()}
patched_opts.update(self.MOCKED_OPTS)
alt_cachedir = os.path.join(RUNTIME_VARS.TMP, "abs_cachedir")
@ -268,7 +260,7 @@ class FileclientCacheTest(
for saltenv in SALTENVS:
self.assertTrue(
client.cache_dir(
"salt://{0}".format(SUBDIR), saltenv, cachedir=alt_cachedir
"salt://{}".format(SUBDIR), saltenv, cachedir=alt_cachedir
)
)
for subdir_file in SUBDIR_FILES:
@ -295,7 +287,7 @@ class FileclientCacheTest(
Ensure entire directory is cached to correct location when an alternate
cachedir is specified and that cachedir is a relative path
"""
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
patched_opts = {x: y for x, y in self.minion_opts.items()}
patched_opts.update(self.MOCKED_OPTS)
alt_cachedir = "foo"
@ -304,7 +296,7 @@ class FileclientCacheTest(
for saltenv in SALTENVS:
self.assertTrue(
client.cache_dir(
"salt://{0}".format(SUBDIR), saltenv, cachedir=alt_cachedir
"salt://{}".format(SUBDIR), saltenv, cachedir=alt_cachedir
)
)
for subdir_file in SUBDIR_FILES:
@ -335,7 +327,7 @@ class FileclientCacheTest(
"""
Ensure file is cached to correct location
"""
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
patched_opts = {x: y for x, y in self.minion_opts.items()}
patched_opts.update(self.MOCKED_OPTS)
with patch.dict(fileclient.__opts__, patched_opts):
@ -365,7 +357,7 @@ class FileclientCacheTest(
Ensure file is cached to correct location when an alternate cachedir is
specified and that cachedir is an absolute path
"""
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
patched_opts = {x: y for x, y in self.minion_opts.items()}
patched_opts.update(self.MOCKED_OPTS)
alt_cachedir = os.path.join(RUNTIME_VARS.TMP, "abs_cachedir")
@ -394,7 +386,7 @@ class FileclientCacheTest(
Ensure file is cached to correct location when an alternate cachedir is
specified and that cachedir is a relative path
"""
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
patched_opts = {x: y for x, y in self.minion_opts.items()}
patched_opts.update(self.MOCKED_OPTS)
alt_cachedir = "foo"
@ -428,7 +420,7 @@ class FileclientCacheTest(
"""
Tests functionality for cache_dest
"""
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
patched_opts = {x: y for x, y in self.minion_opts.items()}
patched_opts.update(self.MOCKED_OPTS)
relpath = "foo.com/bar.txt"
@ -445,7 +437,7 @@ class FileclientCacheTest(
)
def _check(ret, expected):
assert ret == expected, "{0} != {1}".format(ret, expected)
assert ret == expected, "{} != {}".format(ret, expected)
with patch.dict(fileclient.__opts__, patched_opts):
client = fileclient.get_file_client(fileclient.__opts__, pillar=False)