<commit_before>'''
System tests for `jenkinsapi.jenkins` module.
'''
import unittest
from jenkinsapi.build import Build
from jenkinsapi.invocation import Invocation
from jenkinsapi_tests.systests.base import BaseSystemTest
from jenkinsapi_tests.test_utils.random_strings import random_string
from jenkinsapi_tests.systests.job_configs import LONG_RUNNING_JOB, SHORTISH_JOB, EMPTY_JOB


class TestInvocation(BaseSystemTest):

    def test_invocation_object(self):
        job_name = 'create_%s' % random_string()
        job = self.jenkins.create_job(job_name, LONG_RUNNING_JOB)
        ii = job.invoke()
        self.assertIsInstance(ii, Invocation)
        self.assertTrue(ii.is_queued_or_running())
        self.assertEquals(ii.get_build_number(), 1)

    def test_get_block_until_build_running(self):
        job_name = 'create_%s' % random_string()
        job = self.jenkins.create_job(job_name, LONG_RUNNING_JOB)
        ii = job.invoke()
        bn = ii.get_build_number()
        self.assertIsInstance(bn, int)
        ii.block(until='not_queued')
        self.assertTrue(ii.is_running())
        b = ii.get_build()
        self.assertIsInstance(b, Build)
        ii.stop()
        self.assertFalse(ii.is_running())
        self.assertIsInstance(ii.get_build().get_console(), str)
        self.assertIn('Building on master', ii.get_build().get_console())

    def test_get_block_until_build_complete(self):
        job_name = 'create_%s' % random_string()
        job = self.jenkins.create_job(job_name, SHORTISH_JOB)
        ii = job.invoke()
        ii.block(until='completed')
        self.assertFalse(ii.is_running())

    def test_multiple_invocations_and_get_last_build(self):
        job_name = 'create_%s' % random_string()

        job = self.jenkins.create_job(job_name, EMPTY_JOB)

        for _ in range(3):
            ii = job.invoke()
            ii.block(until='completed')

        build_number = job.get_last_buildnumber()
        self.assertEquals(build_number, 3)

        build = job.get_build(build_number)
        self.assertIsInstance(build, Build)



if __name__ == '__main__':
    unittest.main()<commit_msg>tweak to one unit test<commit_after>'''
System tests for `jenkinsapi.jenkins` module.
'''
import unittest
from jenkinsapi.build import Build
from jenkinsapi.invocation import Invocation
from jenkinsapi_tests.systests.base import BaseSystemTest
from jenkinsapi_tests.test_utils.random_strings import random_string
from jenkinsapi_tests.systests.job_configs import LONG_RUNNING_JOB, SHORTISH_JOB, EMPTY_JOB


class TestInvocation(BaseSystemTest):

    def test_invocation_object(self):
        job_name = 'create_%s' % random_string()
        job = self.jenkins.create_job(job_name, LONG_RUNNING_JOB)
        ii = job.invoke()
        self.assertIsInstance(ii, Invocation)
        self.assertTrue(ii.is_queued_or_running())
        self.assertEquals(ii.get_build_number(), 1)

    def test_get_block_until_build_running(self):
        job_name = 'create_%s' % random_string()
        job = self.jenkins.create_job(job_name, LONG_RUNNING_JOB)
        ii = job.invoke()
        bn = ii.get_build_number()
        self.assertIsInstance(bn, int)
        ii.block(until='not_queued')
        self.assertTrue(ii.is_running())
        b = ii.get_build()
        self.assertIsInstance(b, Build)
        ii.stop()
        self.assertFalse(ii.is_running())
        self.assertIsInstance(ii.get_build().get_console(), str)
        self.assertIn('Started by user', ii.get_build().get_console())

    def test_get_block_until_build_complete(self):
        job_name = 'create_%s' % random_string()
        job = self.jenkins.create_job(job_name, SHORTISH_JOB)
        ii = job.invoke()
        ii.block(until='completed')
        self.assertFalse(ii.is_running())

    def test_multiple_invocations_and_get_last_build(self):
        job_name = 'create_%s' % random_string()

        job = self.jenkins.create_job(job_name, EMPTY_JOB)

        for _ in range(3):
            ii = job.invoke()
            ii.block(until='completed')

        build_number = job.get_last_buildnumber()
        self.assertEquals(build_number, 3)

        build = job.get_build(build_number)
        self.assertIsInstance(build, Build)



if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.10582750582750583, 'fraction_numerical': 0.0013986013986013986, 'mean_word_length': 3.3387259858442873, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6192142', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1404, 'n_words': 229}