Example #1
0
    def test_after_script(self):
        travis = '''
language: python
python:
  - 2.7
script:
  - echo 1
  - echo 2
        '''

        tox_config = travis2tox(six.StringIO(travis))
        self.assertEqual(tox_config.commands, ['echo 1', 'echo 2'])
Example #2
0
    def test_before_install(self):
        travis = '''
language: python
python:
  - 2.7
before_install:
  - echo 1
  - echo 2
        '''

        tox_config = travis2tox(six.StringIO(travis))
        self.assertEqual(tox_config.commands, ['echo 1', 'echo 2'])
Example #3
0
def main():
    """The ``main`` for the ``panci`` program."""

    parser = argparse.ArgumentParser(
        description='Convert a .travis.yml file to a tox.ini file or vice-versa.')
    parser.add_argument(
        '-t', '-w', '--to', '--write',
        metavar='FORMAT',
        help='output format')
    parser.add_argument(
        'input_file',
        help='path to a .travis.yml or tox.ini file')
    args = parser.parse_args()

    if args.to == 'tox' or args.input_file.endswith('.yml'):
        tox_config = travis2tox(args.input_file)
        print(tox_config.getvalue())
    elif args.to == 'travis' or args.input_file.endswith('.ini'):
        travis_config = tox2travis(args.input_file)
        print(travis_config)