How to use test_normalRun method in green

Best Python code snippet using green

test__cmd_line.py

Source:test__cmd_line.py Github

copy

Full Screen

...94 self.init("CmdEmma")95 def tearDown(self):96 plt.clf()97 self.deInit()98 def test_normalRun(self):99 """100 Check that an ordinary run is successful101 """102 try:103 args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", self.cmdLineTestOutputFolder])104 Emma.emma.main(args)105 except Exception as e: # pylint: disable=broad-except106 # Rationale: The purpose here is to catch any exception.107 self.fail("Unexpected exception: " + str(e))108 def test_help(self):109 """110 Check that `--help` does not raise an exception but exits with SystemExit(0)111 """112 with self.assertRaises(SystemExit) as context:113 args = Emma.emma.parseArgs(["--help"])114 Emma.emma.main(args)115 self.assertEqual(context.exception.code, 0)116 def test_unrecognisedArgs(self):117 """118 Check that an unexpected argument does raise an exception119 """120 with self.assertRaises(SystemExit) as context:121 args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", self.cmdLineTestOutputFolder, "--blahhhhhh"])122 Emma.emma.main(args)123 self.assertEqual(context.exception.code, 2)124 def test_noProjDir(self):125 """126 Check run with non-existing project folder127 """128 with self.assertRaises(SystemExit) as context:129 args = Emma.emma.parseArgs(["--project", self.nonExistingPath, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", self.cmdLineTestOutputFolder])130 Emma.emma.main(args)131 self.assertEqual(context.exception.code, -10)132 def test_noMapfileDir(self):133 """134 Check run with non-existing mapfile folder135 """136 with self.assertRaises(SystemExit) as context:137 args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.nonExistingPath, "--dir", self.cmdLineTestOutputFolder])138 Emma.emma.main(args)139 self.assertEqual(context.exception.code, -10)140 def test_noDirOption(self):141 """142 Check run without a --dir parameter143 """144 try:145 args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder])146 Emma.emma.main(args)147 except Exception as e: # pylint: disable=broad-except148 # Rationale: The purpose here is to catch any exception.149 self.fail("Unexpected exception: " + str(e))150class CmdEmmaVis(TestHelper):151 # pylint: disable=invalid-name152 # Rationale: Tests need to have the following method names in order to be discovered: test_<METHOD_NAME>().153 """154 Class containing tests for testing the command line argument processing for Emma-Vis.155 """156 def setUp(self):157 self.init("CmdEmmaVis")158 self.runEmma(self.cmdLineTestOutputFolder)159 def tearDown(self):160 self.deInit()161 def runEmma(self, outputFolder=None):162 """163 Function to run the 164 :param outputFolder: The output folder that will be given as the --dir parameter. If it is None, the --dir parameter will not be given to 165 :return: None166 """167 if outputFolder is not None:168 args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", outputFolder, "--noprompt"])169 else:170 args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--noprompt"])171 Emma.emma.main(args)172 def test_normalRun(self):173 """174 Check that an ordinary run is successful175 """176 try:177 argsEmmaVis = Emma.emma_vis.parseArgs(["--project", self.cmdLineTestProjectFolder, "--overview", "--inOutDir", self.cmdLineTestOutputFolder, "--noprompt", "--quiet"])178 Emma.emma_vis.main(argsEmmaVis)179 except Exception as e: # pylint: disable=broad-except180 # Rationale: The purpose here is to catch any exception.181 self.fail("Unexpected exception: " + str(e))182 def test_help(self):183 """184 Check that `--help` does not raise an exception but exits with SystemExit(0)185 """186 with self.assertRaises(SystemExit) as context:...

Full Screen

Full Screen

test_process.py

Source:test_process.py Github

copy

Full Screen

...75 def tearDown(self):76 os.chdir(self.container_dir)77 shutil.rmtree(self.tmpdir)78 # Tests79 def test_normalRun(self):80 """81 Runs normally82 """83 saved_coverage = process.coverage84 process.coverage = MagicMock()85 self.addCleanup(setattr, process, 'coverage', saved_coverage)86 # Parent directory setup87 os.chdir(self.tmpdir)88 sub_tmpdir = tempfile.mkdtemp(dir=self.tmpdir)89 basename = os.path.basename(sub_tmpdir)90 # Child setup91 fh = open(os.path.join(basename, '__init__.py'), 'w')92 fh.write('\n')93 fh.close()...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run green automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful