コード例 #1
0
    def test_insufficient_args(self):
        """
        Calling run() with no args will cause it to print help.
        """
        stringio = NativeStringIO()
        self.patch(sys, 'stdout', stringio)
        self.patch(os, 'getcwd', self.getcwd)
        self.patch(datetime, 'date', self.date)

        with self.assertRaises(SystemExit) as e:
            run(["inctestpkg", "--rc"])

        self.assertEqual(e.exception.args[0], 0)
        self.assertIn("Updating codebase", stringio.getvalue())

        self.assertEqual(self.packagedir.child("_version.py").getContent(),
                         b'''"""
Provides inctestpkg version information.
"""

# This file is auto-generated! Do not edit!
# Use `python -m incremental.update inctestpkg` to change this file.

from incremental import Version

__version__ = Version('inctestpkg', 16, 8, 0, release_candidate=1)
__all__ = ["__version__"]
''')
        self.assertEqual(self.packagedir.child("__init__.py").getContent(),
                         b"""
from incremental import Version
introduced_in = Version('inctestpkg', 16, 8, 0, release_candidate=1).short()
next_released_version = "inctestpkg 16.8.0rc1"
""")
コード例 #2
0
    def test_insufficient_args(self):
        """
        Calling run() with no args will cause it to print help.
        """
        stringio = NativeStringIO()
        self.patch(sys, 'stdout', stringio)
        self.patch(os, 'getcwd', self.getcwd)
        self.patch(datetime, 'date', self.date)

        with self.assertRaises(SystemExit) as e:
            run(["inctestpkg", "--rc"])

        self.assertEqual(e.exception.args[0], 0)
        self.assertIn("Updating codebase", stringio.getvalue())

        self.assertEqual(
            self.packagedir.child("_version.py").getContent(), b'''"""
Provides inctestpkg version information.
"""

# This file is auto-generated! Do not edit!
# Use `python -m incremental.update inctestpkg` to change this file.

from incremental import Version

__version__ = Version('inctestpkg', 16, 8, 0, release_candidate=1)
__all__ = ["__version__"]
''')
        self.assertEqual(
            self.packagedir.child("__init__.py").getContent(), b"""
from incremental import Version
introduced_in = Version('inctestpkg', 16, 8, 0, release_candidate=1).short()
next_released_version = "inctestpkg 16.8.0rc1"
""")
コード例 #3
0
ファイル: test_update.py プロジェクト: twisted/incremental
    def test_run(self):
        """
        Calling run() with no args will cause it to print help.
        """
        stringio = NativeStringIO()
        self.patch(sys, "stdout", stringio)

        with self.assertRaises(SystemExit) as e:
            run(["--help"])

        self.assertEqual(e.exception.args[0], 0)
        self.assertIn("Show this message and exit", stringio.getvalue())
コード例 #4
0
    def test_run(self):
        """
        Calling run() with no args will cause it to print help.
        """
        stringio = NativeStringIO()
        self.patch(sys, 'stdout', stringio)

        with self.assertRaises(SystemExit) as e:
            run(["--help"])

        self.assertEqual(e.exception.args[0], 0)
        self.assertIn("Show this message and exit", stringio.getvalue())