Exemplo n.º 1
0
    def test_project_sublime_command(self, mock_lc):
        """
        test the sublime project command plugin

        """
        mock_config = mock.Mock()
        mock_config.package_name = mock.Mock(return_value='unittests')
        mock_lc.return_value = mock_config

        argslist = [
            'project',
            '-t',
            'Sublime',
            '-r',
            self.repo,
        ]
        opts = build_parser(argslist)
        build_project(opts)
        proj = os.path.join(self.repo, 'unittests.sublime-project')
        self.failUnless(os.path.exists(proj))
        with open(proj, 'r') as handle:
            data = json.load(handle)
        self.failUnless('folders' in data)
        self.failUnless(data['folders'])
        self.failUnless('path' in data['folders'][0])
        self.assertEqual(data['folders'][0]['path'], self.repo)

        build = data['build_systems'][0]
        self.failUnless('name' in build)
        self.assertEqual(build['name'], "cirrus virtualenv")
        self.failUnless('env' in build)
        self.failUnless('PYTHONPATH' in build['env'])
        self.assertEqual(build['env']['PYTHONPATH'], self.repo)
Exemplo n.º 2
0
    def test_project_sublime_command(self, mock_lc):
        """
        test the sublime project command plugin

        """
        mock_config = mock.Mock()
        mock_config.package_name = mock.Mock(return_value='unittests')
        mock_lc.return_value = mock_config

        argslist = [
            'project',
            '-t', 'Sublime',
            '-r', self.repo,
        ]
        opts = build_parser(argslist)
        build_project(opts)
        proj = os.path.join(self.repo, 'unittests.sublime-project')
        self.failUnless(os.path.exists(proj))
        with open(proj, 'r') as handle:
            data = json.load(handle)
        self.failUnless('folders' in data)
        self.failUnless(data['folders'])
        self.failUnless('path' in data['folders'][0])
        self.assertEqual(data['folders'][0]['path'], self.repo)

        build = data['build_systems'][0]
        self.failUnless('name' in build)
        self.assertEqual(build['name'], "cirrus virtualenv")
        self.failUnless('env' in build)
        self.failUnless('PYTHONPATH' in build['env'])
        self.assertEqual(build['env']['PYTHONPATH'], self.repo)
Exemplo n.º 3
0
 def test_init_command(self):
     """test the init command"""
     argslist = [
         'init', '-p', 'throwaway', '-r', self.repo, '--no-remote', '-s',
         'src', '--templates', 'src/throwaway/templates/*'
     ]
     opts = build_parser(argslist)
     init_package(opts)
     conf = os.path.join(self.repo, 'cirrus.conf')
     self.failUnless(os.path.exists(conf))
Exemplo n.º 4
0
    def test_build_parser(self):
        argslist = ['init']
        with mock.patch('sys.stderr'):
            self.assertRaises(SystemExit, build_parser, argslist)

        argslist = ['init', '-p', 'throwaway', '-s', 'src']
        opts = build_parser(argslist)
        self.assertEqual(opts.source, 'src')
        self.assertEqual(opts.package, 'throwaway')
        self.assertEqual(opts.master, 'master')
        self.assertEqual(opts.develop, 'develop')
Exemplo n.º 5
0
    def test_build_parser(self):
        argslist = ['init']
        with mock.patch('sys.stderr'):
            self.assertRaises(SystemExit, build_parser, argslist)

        argslist = ['init', '-p', 'throwaway', '-s', 'src']
        opts = build_parser(argslist)
        self.assertEqual(opts.source, 'src')
        self.assertEqual(opts.package, 'throwaway')
        self.assertEqual(opts.master, 'master')
        self.assertEqual(opts.develop, 'develop')
Exemplo n.º 6
0
 def test_init_command(self):
     """test the init command"""
     argslist = [
         'init', '-p', 'throwaway', '-r', self.repo,
         '--no-remote',
         '-s', 'src',
         '--templates', 'src/throwaway/templates/*'
     ]
     opts = build_parser(argslist)
     init_package(opts)
     conf = os.path.join(self.repo, 'cirrus.conf')
     self.failUnless(os.path.exists(conf))
Exemplo n.º 7
0
 def test_init_command_dot_package(self):
     """test the init command"""
     argslist = [
         'init', '--bootstrap', '-p', 'pkg.module.throwaway', '-r', self.repo,
         '--no-remote',
         '-s', 'src'
     ]
     opts = build_parser(argslist)
     init_package(opts)
     conf = os.path.join(self.repo, 'cirrus.conf')
     self.failUnless(os.path.exists(conf))
     src_dir = os.path.join(self.repo, 'src', 'pkg', 'module', 'throwaway', '__init__.py')
     test_dir = os.path.join(self.repo, 'tests', 'unit', 'pkg', 'module', 'throwaway', '__init__.py')
     sample = os.path.join(self.repo, 'tests', 'unit', 'pkg', 'module', 'throwaway', 'sample_test.py')
     self.failUnless(os.path.exists(src_dir))
     self.failUnless(os.path.exists(test_dir))
Exemplo n.º 8
0
 def test_init_command_dot_package(self):
     """test the init command"""
     argslist = [
         'init', '--bootstrap', '-p', 'pkg.module.throwaway', '-r',
         self.repo, '--no-remote', '-s', 'src'
     ]
     opts = build_parser(argslist)
     init_package(opts)
     conf = os.path.join(self.repo, 'cirrus.conf')
     self.failUnless(os.path.exists(conf))
     src_dir = os.path.join(self.repo, 'src', 'pkg', 'module', 'throwaway',
                            '__init__.py')
     test_dir = os.path.join(self.repo, 'tests', 'unit', 'pkg', 'module',
                             'throwaway', '__init__.py')
     sample = os.path.join(self.repo, 'tests', 'unit', 'pkg', 'module',
                           'throwaway', 'sample_test.py')
     self.failUnless(os.path.exists(src_dir))
     self.failUnless(os.path.exists(test_dir))
Exemplo n.º 9
0
 def test_build_parser_bad_package(self):
     argslist = ['init', '-p', 'th-row-away', '-s', 'src']
     with self.assertRaises(SystemExit):
         build_parser(argslist)
Exemplo n.º 10
0
 def test_build_parser_bad_package(self):
     argslist = ['init', '-p', 'th-row-away', '-s', 'src']
     with self.assertRaises(SystemExit):
         build_parser(argslist)