How to use workbench method in dbt-osmosis

Best Python code snippet using dbt-osmosis_python

test_plugin.py

Source:test_plugin.py Github

copy

Full Screen

...22# =============================================================================23# --- Fixtures ----------------------------------------------------------------24# =============================================================================25@pytest.fixture26def dep_workbench(workbench):27 """Setup the workbench to test dependencies related capabilities.28 """29 workbench.register(CoreManifest())30 workbench.register(DependenciesManifest())31 workbench.register(BuildDep())32 workbench.register(RuntimeDep())33 yield workbench34 workbench.unregister('exopy.app.dependencies')35 workbench.unregister('enaml.workbench.core')36@pytest.fixture37def dependent_object():38 """Access an instance of an object having dependencies.39 """40 class Obj(object):...

Full Screen

Full Screen

test_plugin_tools.py

Source:test_plugin_tools.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2# -----------------------------------------------------------------------------3# Copyright 2015-2018 by Exopy Authors, see AUTHORS for more details.4#5# Distributed under the terms of the BSD license.6#7# The full license is in the file LICENCE, distributed with this software.8# -----------------------------------------------------------------------------9"""Test the plugin tools behaviours.10"""11import pytest12import enaml13from enaml.workbench.api import Workbench14from exopy.utils.plugin_tools import make_extension_validator15from exopy.testing.util import handle_dialog16with enaml.imports():17 from enaml.workbench.core.core_manifest import CoreManifest18 from exopy.app.errors.manifest import ErrorsManifest19 from .plugin_tools_testing import (ExtensionManifest,20 Contribution, DContribution,21 Contributor1, Contributor2,22 Contributor3, Contributor4,23 DeclaratorManifest,24 DContributor1, DContributor2,25 DContributor3, DContributor4,26 DContributor5,27 PLUGIN_ID)28def test_make_extension_validator():29 """Test the building of generic extension validators.30 """31 c_validator = make_extension_validator(Contribution, ('new',))32 assert c_validator(Contribution())[0] is False33 assert c_validator(DContribution())[0] is False34 assert c_validator(DContribution(description='test'))[0] is True35 class CContribution(Contribution):36 def new(self, workbench):37 return 138 assert c_validator(CContribution())[0] is False39 assert c_validator(CContribution(description='test'))[0] is True40class TestExtensionsCollector(object):41 """Test the ExtensionsCollector behaviour.42 """43 def setup(self):44 self.workbench = Workbench()45 self.workbench.register(CoreManifest())46 self.workbench.register(ErrorsManifest())47 self.workbench.register(ExtensionManifest())48 def test_registation1(self, exopy_qtbot):49 """Test that plugin registered before starting the plugin are well50 detected51 """52 c = Contributor1()53 self.workbench.register(c)54 plugin = self.workbench.get_plugin(PLUGIN_ID)55 assert 'contrib1.contrib' in plugin.contribs.contributions56 self.workbench.unregister(c.id)57 assert 'contrib1.contrib' not in plugin.contribs.contributions58 assert not plugin.contribs._extensions59 plugin.contribs.stop()60 assert not plugin.contribs.contributions61 def test_registration2(self, exopy_qtbot):62 """Test contribs update when a new plugin is registered.63 """64 self.workbench.register(Contributor2())65 plugin = self.workbench.get_plugin(PLUGIN_ID)66 c = Contributor1()67 self.workbench.register(c)68 assert 'contrib1.contrib' in plugin.contribs.contributions69 self.workbench.unregister(c.id)70 assert 'contrib1.contrib' not in plugin.contribs.contributions71 def test_factory(self, exopy_qtbot):72 """Test getting the Contribution declaration from a factory.73 """74 c = Contributor2()75 self.workbench.register(c)76 plugin = self.workbench.get_plugin(PLUGIN_ID)77 assert 'contrib2.contrib' in plugin.contribs.contributions78 self.workbench.unregister(c.id)79 assert 'contrib2.contrib' not in plugin.contribs.contributions80 @pytest.mark.ui81 def test_errors1(self, exopy_qtbot):82 """Test uniqueness of contribution id.83 """84 self.workbench.register(Contributor1())85 self.workbench.register(Contributor1(id='bis'))86 self.workbench.register(Contributor1(id='ter'))87 with handle_dialog(exopy_qtbot):88 self.workbench.get_plugin(PLUGIN_ID)89 @pytest.mark.ui90 def test_check_errors2(self, exopy_qtbot):91 """Test use of validate_ext.92 """93 self.workbench.register(Contributor3())94 with handle_dialog(exopy_qtbot):95 self.workbench.get_plugin(PLUGIN_ID)96 def test_check_errors3(self, exopy_qtbot):97 """Test enforcement of type when using factory.98 """99 self.workbench.register(Contributor4())100 with handle_dialog(exopy_qtbot):101 self.workbench.get_plugin(PLUGIN_ID)102 def test_declared_by(self):103 """Test getting the extension declaring a particular contribution.104 """105 c = Contributor1()106 self.workbench.register(c)107 plugin = self.workbench.get_plugin(PLUGIN_ID)108 assert plugin.contribs.contributed_by('contrib1.contrib') is \109 c.extensions[0]110class TestDeclaratorCollector(object):111 """Test the ExtensionsCollector behaviour.112 """113 def setup(self):114 self.workbench = Workbench()115 self.workbench.register(CoreManifest())116 self.workbench.register(ErrorsManifest())117 self.workbench.register(DeclaratorManifest())118 def test_registation1(self, exopy_qtbot):119 """Test that plugin registered before starting the plugin are well120 detected121 """122 d = DContributor1()123 self.workbench.register(d)124 plugin = self.workbench.get_plugin(PLUGIN_ID)125 assert 'contrib1' in plugin.contribs.contributions126 self.workbench.unregister(d.id)127 assert not plugin.contribs.contributions128 assert not plugin.contribs._extensions129 def test_registration2(self, exopy_qtbot):130 """Test contribs update when a new plugin is registered.131 """132 class Witness(object):133 called = 0134 def see(self, change):135 print('r')136 self.called += 1137 w = Witness()138 self.workbench.register(DContributor2())139 plugin = self.workbench.get_plugin(PLUGIN_ID)140 plugin.contribs.observe('contributions', w.see)141 d = DContributor1()142 self.workbench.register(d)143 assert 'contrib1' in plugin.contribs.contributions144 assert w.called == 1145 self.workbench.unregister(d.id)146 assert 'contrib1' not in plugin.contribs.contributions147 assert w.called == 2148 plugin.contribs.stop()149 assert not plugin.contribs.contributions150 assert w.called == 2151 assert not plugin.contribs._extensions152 def test_factory(self, exopy_qtbot):153 """Test getting the TestDeclarator declaration from a factory.154 """155 d = DContributor2()156 self.workbench.register(d)157 plugin = self.workbench.get_plugin(PLUGIN_ID)158 assert 'contrib2' in plugin.contribs.contributions159 self.workbench.unregister(d.id)160 assert not plugin.contribs.contributions161 def test_check_errors1(self, exopy_qtbot):162 """Test enforcement of type when using factory.163 """164 self.workbench.register(DContributor3())165 with handle_dialog(exopy_qtbot):166 self.workbench.get_plugin(PLUGIN_ID)167 @pytest.mark.ui168 def test_declarator_failed_registration(self, exopy_qtbot):169 """Test handling of error when a declarator fail to register.170 """171 self.workbench.register(DContributor4())172 with handle_dialog(exopy_qtbot):173 self.workbench.get_plugin(PLUGIN_ID)174 @pytest.mark.ui175 def test_unsatifiable_requirement(self, exopy_qtbot):176 """Test the case of a declarator always adding itself to _deflayed.177 """178 self.workbench.register(DContributor5())179 with handle_dialog(exopy_qtbot):...

Full Screen

Full Screen

test_workbench.py

Source:test_workbench.py Github

copy

Full Screen

...26 self.workbench_base)27 def teardown(self):28 # If the workbench is empty, this should work.29 os.rmdir(self.workbench_base)30 def test_create_workbench(self):31 workbench = self.workbench_manager.create()32 assert os.path.isdir(workbench.dir)33 assert workbench.dir.startswith(self.workbench_manager.base_workbench_dir)34 workbench.destroy()35 def test_joinpath(self):36 this_workbench = self.workbench_manager.create()37 tmpname = this_workbench.joinpath('temp.txt')38 assert tmpname == os.path.join(this_workbench.dir, 'temp.txt')39 this_workbench.destroy()40 def test_destroy_workbench(self):41 # kill a workbench42 this_workbench = self.workbench_manager.create()43 tmpfile_name = this_workbench.joinpath('temp.txt')44 tmpfile = file(tmpfile_name, 'w')45 with tmpfile:46 tmpfile.write('lollerskates')47 assert os.path.exists(tmpfile_name)48 wb_dir = this_workbench.dir49 this_workbench.destroy()50 assert not os.path.exists(tmpfile_name)51 assert not os.path.exists(wb_dir)52 def test_localized_file(self):53 tmpdir, this_storage = get_tmp_filestorage()54 this_workbench = self.workbench_manager.create()...

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 dbt-osmosis 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