Skip to content

Commit

Permalink
Rework test_usage_string_fork
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Carroll committed Aug 27, 2018
1 parent e457552 commit 0b9d7ca
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions tests/test_cli.py
Expand Up @@ -2,21 +2,20 @@

from __future__ import unicode_literals, print_function

import argparse
import bumpversion
import mock
import os
import platform
import pytest
import sys
import logging
import mock

import argparse
import six
import subprocess
from os import curdir, makedirs, chdir, environ
from os.path import join, curdir, dirname
from os import environ
from shlex import split as shlex_split
from textwrap import dedent
from functools import partial

import bumpversion

from bumpversion import main, DESCRIPTION, WorkingDirectoryIsDirtyException, \
split_args_in_optional_and_positional
Expand Down Expand Up @@ -154,18 +153,26 @@ def test_usage_string(tmpdir, capsys):

assert EXPECTED_USAGE in out


def test_usage_string_fork(tmpdir, capsys):
tmpdir.chdir()

if platform.system() == "Windows" and six.PY3:
# There are encoding problems on Windows with the encoding of →
tmpdir.join(".bumpversion.cfg").write("""[bumpversion]
message: Bump version: {current_version} to {new_version}
tag_message: 'Bump version: {current_version} to {new_version}""")

try:
out = check_output('bumpversion --help', shell=True, stderr=subprocess.STDOUT).decode('utf-8')
out = check_output('bumpversion --help', shell=True, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
out = e.output

if not 'usage: bumpversion [-h]' in out:
if not b'usage: bumpversion [-h]' in out:
print(out)

assert 'usage: bumpversion [-h]' in out
assert b'usage: bumpversion [-h]' in out


@pytest.mark.parametrize(("vcs"), [xfail_if_no_git("git"), xfail_if_no_hg("hg")])
def test_regression_help_in_workdir(tmpdir, capsys, vcs):
Expand Down

0 comments on commit 0b9d7ca

Please sign in to comment.