def testCommand(self): Logger.command(('ls', 'a b')) self.assertEqual(Logger.stdout.getvalue(), '') Logger.set_verbosity(True) Logger.command(('ls', 'a b')) self.assertEqual(Logger.stdout.getvalue(), 'test: I: ls "a b"\n') self.assertEqual(Logger.stderr.getvalue(), '')
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """This module implements facilities to deal with Debian control.""" import os import sys from devscripts.logger import Logger try: import debian.deb822 except ImportError: Logger.error( "Please install 'python3-debian' in order to use this utility.") sys.exit(1) def _insert_after(paragraph, item_before, new_item, new_value): """Insert new_item into directly after item_before New items added to a dictionary are appended.""" item_found = False for item in paragraph: if item_found: value = paragraph.pop(item) paragraph[item] = value if item == item_before: item_found = True paragraph[new_item] = new_value
def testArgs(self): # pylint: disable=no-member Logger.normal('hello %s', 'world') self.assertEqual(Logger.stdout.getvalue(), 'test: hello world\n') self.assertEqual(Logger.stderr.getvalue(), '')
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """This module implements facilities to deal with Debian control.""" import os import sys from devscripts.logger import Logger try: import debian.deb822 except ImportError: Logger.error("Please install 'python-debian' in order to use this utility.") sys.exit(1) def _insert_after(paragraph, item_before, new_item, new_value): """Insert new_item into directly after item_before New items added to a dictionary are appended.""" item_found = False for item in paragraph: if item_found: value = paragraph.pop(item) paragraph[item] = value if item == item_before: item_found = True paragraph[new_item] = new_value if not item_found:
def testArgs(self): Logger.normal('hello %s', 'world') self.assertEqual(Logger.stdout.getvalue(), 'test: hello world\n') self.assertEqual(Logger.stderr.getvalue(), '')
def testNoArgs(self): Logger.normal('hello %s') self.assertEqual(Logger.stdout.getvalue(), 'test: hello %s\n') self.assertEqual(Logger.stderr.getvalue(), '')