How to use has_fixture method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

tests.py

Source:tests.py Github

copy

Full Screen

...52 yield (53 maximize_window,54 relative_url, ('/',),55 )56 if not self.testcase.has_fixture('new_user_registered'):57 yield from self.register_new_user()58 yield from self.logout_user()59 yield from self.login_user()60 yield from self.user_preferences()61 if not self.testcase.has_fixture('sport_club_updated'):62 yield from ClubAppCommands().yield_class_commands(63 'empty_club_list',64 'add_sport_club',65 'details_sport_club',66 'update_sport_club',67 )68 yield from EventAppCommands().yield_class_commands(69 'event_list_navigate',70 'event_list_preview_member',71 )72 if not self.testcase.has_fixture('grid_interaction_club_actions_done'):73 yield from EventAppCommands().yield_class_commands(74 'grid_interaction_club_actions',75 )76 if not self.testcase.has_fixture('grid_interaction_club_equipment_done'):77 yield from ClubAppCommands().yield_class_commands(78 'browse_grid_with_raw_query',79 'grid_interaction_club_equipment',80 )81 if not self.testcase.has_fixture('grid_custom_actions_done'):82 yield from ClubAppCommands().yield_class_commands(83 'grid_custom_layout',84 'grid_custom_actions',85 'to_club_member_grid_page',86 # Check manual component invocation. Issued twice to check component re-instantiation.87 'manual_component_invocation',88 'manual_component_invocation',...

Full Screen

Full Screen

conftest.py

Source:conftest.py Github

copy

Full Screen

...18 if marker:19 validate_django_db(marker)20 return marker.kwargs["transaction"]21 return None22 def has_fixture(test, fixture):23 fixturenames = getattr(test, "fixturenames", None)24 return fixturenames and fixture in fixturenames25 def weight_test_case(test):26 """27 Key function for ordering test cases like the Django test runner.28 """29 is_test_case_subclass = test.cls and issubclass(test.cls, TestCase)30 is_transaction_test_case_subclass = test.cls and issubclass(31 test.cls, TransactionTestCase32 )33 if is_test_case_subclass or get_marker_transaction(test) is False:34 return 035 elif has_fixture(test, "db"):36 return 037 if is_transaction_test_case_subclass or get_marker_transaction(test) is True:38 return 139 elif has_fixture(test, "transactional_db"):40 return 141 return 042 items.sort(key=weight_test_case)43@pytest.fixture(autouse=True)44def constants(request, reset_cache):45 """46 Resets the constants on every test. The filled cache is needed to47 build the constants, because some of them depends on the config.48 Uses fake constants, if the db is not in use.49 """50 from openslides.utils.constants import get_constants_from_apps, set_constants51 if "django_db" in request.node.keywords or is_django_unittest(request):52 # When the db is created, use the original constants53 set_constants(get_constants_from_apps())...

Full Screen

Full Screen

setup.py

Source:setup.py Github

copy

Full Screen

1import os2import json3import logging4from datetime import datetime5from sqlalchemy.orm import sessionmaker6from sqlalchemy.sql.schema import MetaData7from sqlalchemy import event, create_engine8from sqlalchemy import Column, DateTime, Integer9from sqlalchemy.ext.declarative import declarative_base, declared_attr10from models.user import User11from models.element import Element12from models.session import Session13from models.commodity import Commodity, ChemicalConcentrations14cur_dir = os.path.dirname(os.path.abspath(__file__))15base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))16db_path = os.path.join(base_dir, "optimizer.sqlite3")17SQLALCHEMY_DATABASE_URL = "sqlite:///{0}".format(db_path)18engine = create_engine(19 SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}20)21DataBaseSession = sessionmaker(autocommit=False, autoflush=False, bind=engine)22def setup_database() -> None:23 db = DataBaseSession()24 models = [ User, Session, Element, Commodity, ChemicalConcentrations ]25 for model in models:26 model_name = model.__tablename__27 if engine.dialect.has_table(engine, model.__tablename__):28 continue29 print("Creating {0} Table".format(model.__tablename__))30 model.__table__.create(bind=engine)31 fixtures_path = os.path.join(base_dir, "fixtures", "{}.json".format(model_name.lower()))32 has_fixture = os.path.isfile(fixtures_path)33 print("Has Fixtures {0}".format(has_fixture))34 if not has_fixture:35 continue36 fixtures = []37 with open(fixtures_path, "r") as _file:38 fixtures = json.loads(_file.read())39 print("Adding fixtures for {0}".format(model_name))40 [db.add(model(**fixture)) for fixture in fixtures]...

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