1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
From: =?utf-8?q?Rapha=C3=ABl_Hertzog?= <raphael@freexian.com>
Date: Tue, 19 Jan 2021 16:26:29 +0100
Subject: Disable CLI tests as we don't have python3-delegator in Debian
---
setup.py | 1 -
tests/test_cli.py | 113 ------------------------------------------------------
2 files changed, 114 deletions(-)
delete mode 100644 tests/test_cli.py
diff --git a/setup.py b/setup.py
index 4ca9fda..e5e165e 100644
--- a/setup.py
+++ b/setup.py
@@ -80,5 +80,4 @@ setup(
classifiers=CLASSIFIERS,
scripts=['bin/num2words'],
install_requires=["docopt>=0.6.2"],
- tests_require=['delegator.py'],
)
diff --git a/tests/test_cli.py b/tests/test_cli.py
deleted file mode 100644
index f4b9b4b..0000000
--- a/tests/test_cli.py
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
-# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
-
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301 USA
-
-from __future__ import unicode_literals
-
-import os
-import unittest
-
-import delegator
-
-import num2words
-
-
-class CliCaller(object):
-
- def __init__(self):
- self.cmd = os.path.realpath(os.path.join(os.path.dirname(__file__),
- "..", "bin", "num2words"))
- self.cmd_list = ["python", self.cmd]
-
- def run_cmd(self, *args):
- cmd_list = self.cmd_list + [str(arg) for arg in args]
- cmd = " ".join(cmd_list)
- return delegator.run(cmd)
-
-
-class CliTestCase(unittest.TestCase):
- """Test the command line app"""
-
- def setUp(self):
- self.cli = CliCaller()
-
- def test_cli_help(self):
- """num2words without arguments should exit with status 1
- and show docopt's default short usage message
- """
- output = self.cli.run_cmd()
- self.assertEqual(output.return_code, 1)
- self.assertTrue(output.err.startswith('Usage:'))
-
- def test_cli_list_langs(self):
- """You should be able to list all available languages
- """
- output = self.cli.run_cmd('--list-languages')
- self.assertEqual(
- sorted(list(num2words.CONVERTER_CLASSES.keys())),
- [out for out in output.out.strip().splitlines() if out]
- )
- output = self.cli.run_cmd('-L')
- self.assertEqual(
- sorted(list(num2words.CONVERTER_CLASSES.keys())),
- [out for out in output.out.strip().splitlines() if out]
- )
-
- def test_cli_list_converters(self):
- """You should be able to list all available converters
- """
- output = self.cli.run_cmd('--list-converters')
- self.assertEqual(
- sorted(list(num2words.CONVERTES_TYPES)),
- [out for out in output.out.strip().splitlines() if out]
- )
- output = self.cli.run_cmd('-C')
- self.assertEqual(
- sorted(list(num2words.CONVERTES_TYPES)),
- [out for out in output.out.strip().splitlines() if out]
- )
-
- def test_cli_default_lang(self):
- """Default to english
- """
- output = self.cli.run_cmd(150)
- self.assertEqual(output.return_code, 0)
- self.assertEqual(
- output.out.strip(),
- "one hundred and fifty"
- )
-
- def test_cli_with_lang(self):
- """You should be able to specify a language
- """
- output = self.cli.run_cmd(150, '--lang', 'es')
- self.assertEqual(output.return_code, 0)
- self.assertEqual(
- output.out.strip(),
- "ciento cincuenta"
- )
-
- def test_cli_with_lang_to(self):
- """You should be able to specify a language and currency
- """
- output = self.cli.run_cmd(150.55, '--lang', 'es', '--to', 'currency')
- self.assertEqual(output.return_code, 0)
- self.assertEqual(
- (output.out.decode('utf-8') if hasattr(output.out, 'decode') else
- output.out).strip(),
- "ciento cincuenta euros con cincuenta y cinco céntimos"
- )
|