Exemplo n.º 1
0
    def check_raise_verboseversion_test(self):
        on_version_ind = -1
        self.mockrepo_real(on_version_ind=on_version_ind)

        with mock.patch('builtins.print', autospec=True) as m:
            vcheck.check_raise(self.mod2check, version=current_versions[on_version_ind], verbose=True)

            self.assertEqual(m.call_count, 1)
            self.assertRegex(m.call_args[0][0], 'VCheck: Module vcheck matches requested version .*')
Exemplo n.º 2
0
    def check_raise_verbosehexsha_test(self):
        with mock.patch('builtins.print', autospec=True) as m:
            vcheck.check_raise(self.mod2check, hexsha=current_hexsha, verbose=True)

            self.assertEqual(m.call_count, 1)
            self.assertRegex(m.call_args[0][0], 'VCheck: Module vcheck matches requested hexsha .*')
Exemplo n.º 3
0
 def check_raise_versionfails_test(self):
     on_version_ind = -1
     self.mockrepo_real(on_version_ind=on_version_ind)
     
     with self.assertRaisesRegex(vcheck.VersionError, 'Module .* with version .* does not match requested: .*'):
         vcheck.check_raise(self.mod2check, version=unpresent_version)
Exemplo n.º 4
0
 def check_raise_versionerrors_test(self):
     with self.assertRaisesRegex(vcheck.VersionError, 'Repo for module .* does not match a released version.'):
         vcheck.check_raise(self.mod2check, version=unpresent_version)
Exemplo n.º 5
0
 def check_raise_versionmatches_test(self):
     on_version_ind = -1
     self.mockrepo_real(on_version_ind=on_version_ind)
     
     vcheck.check_raise(self.mod2check, version=current_versions[on_version_ind])
Exemplo n.º 6
0
 def check_raise_hexshafails_test(self):
     with self.assertRaisesRegex(vcheck.VersionError, 'Module .* with hexsha .* does not match requested: .*'):
         vcheck.check_raise(self.mod2check, hexsha=unpresent_hexsha)
Exemplo n.º 7
0
 def check_raise_hexshamatches_test(self):
     vcheck.check_raise(self.mod2check, hexsha=current_hexsha)
Exemplo n.º 8
0
    def check_raise_notenoughargs_test(self):
        on_version_ind = -1
        self.mockrepo_real(on_version_ind=on_version_ind)

        with self.assertRaisesRegex(ValueError, 'Neither hexsha nor version specified'):
            vcheck.check_raise(self.mod2check)
Exemplo n.º 9
0
    def check_raise_toomanyargs_test(self):
        on_version_ind = -1
        self.mockrepo_real(on_version_ind=on_version_ind)

        with self.assertRaisesRegex(ValueError, 'Only specify either hexsha (.*) or version(.*)'):
            vcheck.check_raise(self.mod2check, hexsha=current_hexshas[on_version_ind] , version=current_versions[on_version_ind])