How to use unstub method in autotest

Best Python code snippet using autotest_python

test_path.py

Source:test_path.py Github

copy

Full Screen

...13 def test_normalize_windows(self):14 """Test normalize returns a linux style path in windows."""15 when(sublime).platform().thenReturn("windows")16 self.assertEqual("a/b/c.txt", path.normalize_path_for_st("a\\b\\c.txt"))17 unstub(sublime)18class PackagesPathTest(unittest.TestCase):19 """Tests for packages_path."""20 def test_path(self):21 """Test get relative packages path."""22 test_path = "/a/b/Packages"23 when(sublime).packages_path().thenReturn(test_path)24 self.assertEqual("Packages", path.packages_path(path.RELATIVE))25 unstub(sublime)26 def test_absolute_path(self):27 """Test get absolute packages path."""28 test_path = "/a/b/Packages"29 when(sublime).packages_path().thenReturn(test_path)30 self.assertEqual(test_path, path.packages_path(path.ABSOLUTE))31 unstub(sublime)32class DataPathTest(unittest.TestCase):33 """Tests for data_path."""34 def test_path(self):35 """Test get relative data path."""36 test_path = "/a/b/Packages"37 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)38 when(sublime).packages_path().thenReturn(test_path)39 self.assertEqual("Packages/User/ColorHighlighter", path.data_path(path.RELATIVE))40 unstub(sublime)41 unstub(os.path)42 def test_path_package(self):43 """Test get relative data path with a package installation."""44 test_path = "/a/b/Packages"45 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(False)46 when(sublime).packages_path().thenReturn(test_path)47 self.assertEqual("Packages/User/Color Highlighter", path.data_path(path.RELATIVE))48 unstub(sublime)49 unstub(os.path)50 def test_absolute_path(self):51 """Test get absolute data path."""52 test_path = "/a/b/Packages"53 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)54 when(sublime).packages_path().thenReturn(test_path)55 self.assertEqual(test_path + "/User/ColorHighlighter", path.data_path(path.ABSOLUTE))56 unstub(sublime)57 unstub(os.path)58class IconsPathTest(unittest.TestCase):59 """Tests for icons_path."""60 def test_path(self):61 """Test get relative icons path."""62 test_path = "/a/b/Packages"63 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)64 when(sublime).packages_path().thenReturn(test_path)65 self.assertEqual("Packages/User/ColorHighlighter/icons", path.icons_path(path.RELATIVE))66 unstub(sublime)67 unstub(os.path)68 def test_path_package(self):69 """Test get relative icons path with a package installation."""70 test_path = "/a/b/Packages"71 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(False)72 when(sublime).packages_path().thenReturn(test_path)73 self.assertEqual("Packages/User/Color Highlighter/icons", path.icons_path(path.RELATIVE))74 unstub(sublime)75 unstub(os.path)76 def test_absolute_path(self):77 """Test get absolute icons path."""78 test_path = "/a/b/Packages"79 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)80 when(sublime).packages_path().thenReturn(test_path)81 self.assertEqual(test_path + "/User/ColorHighlighter/icons", path.icons_path(path.ABSOLUTE))82 unstub(sublime)83 unstub(os.path)84class ThemesPathTest(unittest.TestCase):85 """Tests for themes_path."""86 def test_path(self):87 """Test get relative themes path."""88 test_path = "/a/b/Packages"89 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)90 when(sublime).packages_path().thenReturn(test_path)91 self.assertEqual("Packages/User/ColorHighlighter/themes", path.themes_path(path.RELATIVE))92 unstub(sublime)93 unstub(os.path)94 def test_path_package(self):95 """Test get relative themes path with a package installation."""96 test_path = "/a/b/Packages"97 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(False)98 when(sublime).packages_path().thenReturn(test_path)99 self.assertEqual("Packages/User/Color Highlighter/themes", path.themes_path(path.RELATIVE))100 unstub(sublime)101 unstub(os.path)102 def test_absolute_path(self):103 """Test get absolute themes path."""104 test_path = "/a/b/Packages"105 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)106 when(sublime).packages_path().thenReturn(test_path)107 self.assertEqual(test_path + "/User/ColorHighlighter/themes", path.themes_path(path.ABSOLUTE))108 unstub(sublime)109 unstub(os.path)110class ColorPickerPathTest(unittest.TestCase):111 """Tests for color_picker_path."""112 def test_path(self):113 """Test get relative color picker path."""114 test_path = "/a/b/Packages"115 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)116 when(sublime).packages_path().thenReturn(test_path)117 self.assertEqual("Packages/User/ColorHighlighter/ColorPicker", path.color_picker_path(path.RELATIVE))118 unstub(sublime)119 unstub(os.path)120 def test_absolute_path(self):121 """Test get absolute color picker path."""122 test_path = "/a/b/Packages"123 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)124 when(sublime).packages_path().thenReturn(test_path)125 self.assertEqual(test_path + "/User/ColorHighlighter/ColorPicker", path.color_picker_path(path.ABSOLUTE))126 unstub(sublime)127 unstub(os.path)128class ColorPickerFileTest(unittest.TestCase):129 """Tests for color_picker_file."""130 def test_path(self):131 """Test get relative color picker path."""132 test_path = "/a/b/Packages"133 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)134 when(sublime).packages_path().thenReturn(test_path)135 platform = "platform"136 arch = "arch"137 when(sublime).platform().thenReturn(platform)138 when(sublime).arch().thenReturn(arch)139 self.assertEqual(140 "Packages/User/ColorHighlighter/ColorPicker/ColorPicker_%s_%s" % (platform, arch),141 path.color_picker_file(path.RELATIVE))142 unstub(sublime)143 unstub(os.path)144 def test_path_package(self):145 """Test get relative color picker path with a package installation."""146 test_path = "/a/b/Packages"147 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(False)148 when(sublime).packages_path().thenReturn(test_path)149 platform = "platform"150 arch = "arch"151 when(sublime).platform().thenReturn(platform)152 when(sublime).arch().thenReturn(arch)153 self.assertEqual(154 "Packages/User/Color Highlighter/ColorPicker/ColorPicker_%s_%s" % (platform, arch),155 path.color_picker_file(path.RELATIVE))156 unstub(sublime)157 unstub(os.path)158 def test_path_windows(self):159 """Test get relative color picker path."""160 test_path = "/a/b/Packages"161 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)162 when(sublime).packages_path().thenReturn(test_path)163 when(sublime).platform().thenReturn("windows")164 self.assertEqual(165 "Packages/User/ColorHighlighter/ColorPicker/ColorPicker_win.exe",166 path.color_picker_file(path.RELATIVE))167 unstub(sublime)168 unstub(os.path)169 def test_absolute_path(self):170 """Test get absolute color picker path."""171 test_path = "/a/b/Packages"172 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)173 when(sublime).packages_path().thenReturn(test_path)174 platform = "platform"175 arch = "arch"176 when(sublime).platform().thenReturn(platform)177 when(sublime).arch().thenReturn(arch)178 self.assertEqual(179 test_path + "/User/ColorHighlighter/ColorPicker/ColorPicker_%s_%s" % (platform, arch),180 path.color_picker_file(path.ABSOLUTE))181 unstub(sublime)182 unstub(os.path)183class FakeColorSchemeTest(unittest.TestCase):184 """Tests for fake_color_scheme_path."""185 def test_path(self):186 """Test get a fake color scheme path for a color scheme."""187 test_path = "/a/b/Packages"188 scheme = "Scheme.tmTheme"189 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)190 when(sublime).packages_path().thenReturn(test_path)191 self.assertEqual(192 "Packages/User/ColorHighlighter/themes/" + scheme,193 path.fake_color_scheme_path("Color/" + scheme, path.RELATIVE))194 unstub(sublime)195 unstub(os.path)196 def test_absolute_path(self):197 """Test get absolute themes path."""198 test_path = "/a/b/Packages"199 scheme = "Scheme.tmTheme"200 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)201 when(sublime).packages_path().thenReturn(test_path)202 self.assertEqual(203 test_path + "/User/ColorHighlighter/themes/" + scheme,204 path.fake_color_scheme_path("Color/" + scheme, path.ABSOLUTE))205 unstub(sublime)206 unstub(os.path)207 def test_absolute_path_package(self):208 """Test get absolute themes path with a package installation."""209 test_path = "/a/b/Packages"210 scheme = "Scheme.tmTheme"211 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(False)212 when(sublime).packages_path().thenReturn(test_path)213 self.assertEqual(214 test_path + "/User/Color Highlighter/themes/" + scheme,215 path.fake_color_scheme_path("Color/" + scheme, path.ABSOLUTE))216 unstub(sublime)217 unstub(os.path)218 def test_path_windows(self):219 """Test get a fake color scheme path for a color scheme on windows."""220 test_path = "/a/b/Packages"221 scheme = "Scheme.tmTheme"222 when(os.path).exists(test_path + "/ColorHighlighter/" + COLOR_HIGHLIGHTER_SETTINGS_NAME).thenReturn(True)223 when(sublime).platform().thenReturn("windows")224 when(sublime).packages_path().thenReturn(test_path)225 self.assertEqual(226 "Packages/User/ColorHighlighter/themes/" + scheme,227 path.fake_color_scheme_path("Color/" + scheme, path.RELATIVE))228 unstub(sublime)...

Full Screen

Full Screen

plugin.py

Source:plugin.py Github

copy

Full Screen

2@pytest.fixture3def unstub_():4 from mockito import unstub5 yield unstub6 unstub()7@pytest.fixture8def unstub(unstub_):9 from mockito import verifyStubbedInvocationsAreUsed10 yield unstub_11 verifyStubbedInvocationsAreUsed()12@pytest.fixture13def when(unstub):14 from mockito import when15 yield when16@pytest.fixture17def when2(unstub):18 from mockito import when219 yield when220@pytest.fixture21def expect(unstub):22 from mockito import expect, verifyNoUnwantedInteractions...

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 autotest 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