mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #44467 from twangboy/win_fix_test_doc
Fix `unit.test_doc` for Windows
This commit is contained in:
commit
4f3a79df07
1 changed files with 6 additions and 7 deletions
|
@ -7,6 +7,7 @@
|
|||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
import re
|
||||
|
||||
# Import Salt Testing libs
|
||||
from tests.support.unit import TestCase
|
||||
|
@ -44,7 +45,7 @@ class DocTestCase(TestCase):
|
|||
salt_dir += '/'
|
||||
cmd = 'grep -r :doc: ' + salt_dir
|
||||
|
||||
grep_call = salt.modules.cmdmod.run_stdout(cmd=cmd).split('\n')
|
||||
grep_call = salt.modules.cmdmod.run_stdout(cmd=cmd).split(os.linesep)
|
||||
|
||||
test_ret = {}
|
||||
for line in grep_call:
|
||||
|
@ -52,12 +53,10 @@ class DocTestCase(TestCase):
|
|||
if line.startswith('Binary'):
|
||||
continue
|
||||
|
||||
if salt.utils.is_windows():
|
||||
# Need the space after the colon so it doesn't split the drive
|
||||
# letter
|
||||
key, val = line.split(': ', 1)
|
||||
else:
|
||||
key, val = line.split(':', 1)
|
||||
# Only split on colons not followed by a '\' as is the case with
|
||||
# Windows Drives
|
||||
regex = re.compile(r':(?!\\)')
|
||||
key, val = regex.split(line, 1)
|
||||
|
||||
# Don't test man pages, this file,
|
||||
# the page that documents to not use ":doc:", or
|
||||
|
|
Loading…
Add table
Reference in a new issue