mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #45302 from gtmanfred/proxyp3
fix proxy tests for py3 on 2017.7
This commit is contained in:
commit
f49b204b75
@ -9,8 +9,9 @@ import os
|
||||
import pickle
|
||||
import logging
|
||||
|
||||
# Import Salt modules
|
||||
import salt.utils.files
|
||||
# Import Salt libs
|
||||
import salt.ext.six as six
|
||||
import salt.utils
|
||||
|
||||
# This must be present or the Salt loader won't load this module
|
||||
__proxyenabled__ = ['dummy']
|
||||
@ -45,9 +46,13 @@ def _save_state(details):
|
||||
|
||||
def _load_state():
|
||||
try:
|
||||
pck = open(FILENAME, 'r') # pylint: disable=W8470
|
||||
DETAILS = pickle.load(pck)
|
||||
pck.close()
|
||||
if six.PY3 is True:
|
||||
mode = 'rb'
|
||||
else:
|
||||
mode = 'r'
|
||||
|
||||
with salt.utils.fopen(FILENAME, mode) as pck:
|
||||
DETAILS = pickle.load(pck)
|
||||
except EOFError:
|
||||
DETAILS = {}
|
||||
DETAILS['initialized'] = False
|
||||
@ -135,7 +140,7 @@ def service_list():
|
||||
List "services" on the REST server
|
||||
'''
|
||||
DETAILS = _load_state()
|
||||
return DETAILS['services'].keys()
|
||||
return list(DETAILS['services'])
|
||||
|
||||
|
||||
def service_status(name):
|
||||
|
@ -33,6 +33,7 @@ from tests.support.xmlunit import HAS_XMLRUNNER, XMLTestRunner
|
||||
|
||||
# Import 3rd-party libs
|
||||
import salt.ext.six as six
|
||||
import salt.utils
|
||||
try:
|
||||
from tests.support.ext import console
|
||||
WIDTH, HEIGHT = console.getTerminalSize()
|
||||
@ -455,6 +456,10 @@ class SaltTestingParser(optparse.OptionParser):
|
||||
logging_level = logging.INFO
|
||||
else:
|
||||
logging_level = logging.ERROR
|
||||
if salt.utils.is_windows():
|
||||
os.environ['TESTS_LOG_LEVEL'] = six.binary_type(self.options.verbosity)
|
||||
else:
|
||||
os.environ['TESTS_LOG_LEVEL'] = six.text_type(self.options.verbosity)
|
||||
consolehandler.setLevel(logging_level)
|
||||
logging.root.addHandler(consolehandler)
|
||||
log.info('Runtests logging has been setup')
|
||||
|
Loading…
Reference in New Issue
Block a user