Best Python code snippet using autotest_python
job_unittest.py
Source:job_unittest.py  
...151        harness.select.expect_call(None,152                                   self.job,153                                   None).and_return(my_harness)154        return resultdir, my_harness155    def _setup_post_record_init(self, cont, resultdir, my_harness):156        # now some specific stubs157        self.god.stub_function(self.job, 'config_get')158        self.god.stub_function(self.job, 'config_set')159        self.god.stub_function(self.job, 'record')160        # other setup161        results = os.path.join(self.autodir, 'results')162        download = os.path.join(self.autodir, 'tests', 'download')163        pkgdir = os.path.join(self.autodir, 'packages')164        utils.drop_caches.expect_call()165        job_sysinfo = sysinfo.sysinfo.expect_new(resultdir)166        if not cont:167            os.path.exists.expect_call(download).and_return(False)168            os.mkdir.expect_call(download)169            shutil.copyfile.expect_call(mock.is_string_comparator(),170                                 os.path.join(resultdir, 'control'))171        job.local_host.LocalHost.expect_new(hostname='localhost')172        job_sysinfo.log_per_reboot_data.expect_call()173        if not cont:174            self.job.record.expect_call('START', None, None)175        my_harness.run_start.expect_call()176    def construct_job(self, cont):177        # will construct class instance using __new__178        self.job = job.base_client_job.__new__(job.base_client_job)179        # record180        resultdir, my_harness = self._setup_pre_record_init(cont)181        self._setup_post_record_init(cont, resultdir, my_harness)182        # finish constructor183        options = dummy()184        options.tag = self.jobtag185        options.cont = cont186        options.harness = None187        options.harness_args = None188        options.log = False189        options.verbose = False190        options.hostname = 'localhost'191        options.user = 'my_user'192        options.args = ''193        options.output_dir = ''194        self.job.__init__(self.control, options)195        # check...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
