Skip to content

Commit

Permalink
add no_color test
Browse files Browse the repository at this point in the history
  • Loading branch information
callmecampos committed Jun 5, 2020
1 parent 0379103 commit 5e26675
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 9 additions & 0 deletions tests/test_main.py
Expand Up @@ -10,6 +10,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

import colorama
import pretend

Expand All @@ -25,3 +27,10 @@ def test_exception_handling(monkeypatch):
dunder_main.main()
== colorama.Fore.RED + "InvalidConfiguration: foo" + colorama.Style.RESET_ALL
)


def test_no_color_exception(monkeypatch):
replaced_dispatch = pretend.raiser(exceptions.InvalidConfiguration("foo"))
monkeypatch.setattr(cli, "dispatch", replaced_dispatch)
monkeypatch.setattr(sys, "argv", ["upload", "--no_color"])
assert dunder_main.main() == "InvalidConfiguration: foo"
1 change: 0 additions & 1 deletion twine/__main__.py
Expand Up @@ -27,7 +27,6 @@ def main() -> Any:
try:
return cli.dispatch(sys.argv[1:])
except (exceptions.TwineException, requests.HTTPError) as exc:
# somehow parse args here
parser = argparse.ArgumentParser()
parser.add_argument(
"--no_color", default=False, required=False, action="store_true",
Expand Down

0 comments on commit 5e26675

Please sign in to comment.