How to use _filter_tasks_by_tags method in locust

Best Python code snippet using locust

env.py

Source:env.py Github

copy

Full Screen

...74 self.reset_stats = reset_stats75 self.stop_timeout = stop_timeout76 self.catch_exceptions = catch_exceptions77 self.parsed_options = parsed_options78 self._filter_tasks_by_tags()79 def _create_runner(self, runner_class, *args, **kwargs):80 if self.runner is not None:81 raise RunnerAlreadyExistsError("Environment.runner already exists (%s)" % self.runner)82 self.runner = runner_class(self, *args, **kwargs)83 # Attach the runner to the shape class so that the shape class can access user count state84 if self.shape_class:85 self.shape_class.runner = self.runner86 return self.runner87 def create_local_runner(self):88 """89 Create a :class:`LocalRunner <locust.runners.LocalRunner>` instance for this Environment90 """91 return self._create_runner(LocalRunner)92 def create_master_runner(self, master_bind_host="*", master_bind_port=5557):93 """94 Create a :class:`MasterRunner <locust.runners.MasterRunner>` instance for this Environment95 :param master_bind_host: Interface/host that the master should use for incoming worker connections.96 Defaults to "*" which means all interfaces.97 :param master_bind_port: Port that the master should listen for incoming worker connections on98 """99 return self._create_runner(100 MasterRunner,101 master_bind_host=master_bind_host,102 master_bind_port=master_bind_port,103 )104 def create_worker_runner(self, master_host, master_port):105 """106 Create a :class:`WorkerRunner <locust.runners.WorkerRunner>` instance for this Environment107 :param master_host: Host/IP of a running master node108 :param master_port: Port on master node to connect to109 """110 # Create a new RequestStats with use_response_times_cache set to False to save some memory111 # and CPU cycles, since the response_times_cache is not needed for Worker nodes112 self.stats = RequestStats(use_response_times_cache=False)113 return self._create_runner(114 WorkerRunner,115 master_host=master_host,116 master_port=master_port,117 )118 def create_web_ui(119 self,120 host="",121 port=8089,122 auth_credentials=None,123 tls_cert=None,124 tls_key=None,125 stats_csv_writer=None,126 delayed_start=False,127 ):128 """129 Creates a :class:`WebUI <locust.web.WebUI>` instance for this Environment and start running the web server130 :param host: Host/interface that the web server should accept connections to. Defaults to ""131 which means all interfaces132 :param port: Port that the web server should listen to133 :param auth_credentials: If provided (in format "username:password") basic auth will be enabled134 :param tls_cert: An optional path (str) to a TLS cert. If this is provided the web UI will be135 served over HTTPS136 :param tls_key: An optional path (str) to a TLS private key. If this is provided the web UI will be137 served over HTTPS138 :param stats_csv_writer: `StatsCSV <stats_csv.StatsCSV>` instance.139 :param delayed_start: Whether or not to delay starting web UI until `start()` is called. Delaying web UI start140 allows for adding Flask routes or Blueprints before accepting requests, avoiding errors.141 """142 self.web_ui = WebUI(143 self,144 host,145 port,146 auth_credentials=auth_credentials,147 tls_cert=tls_cert,148 tls_key=tls_key,149 stats_csv_writer=stats_csv_writer,150 delayed_start=delayed_start,151 )152 return self.web_ui153 def _filter_tasks_by_tags(self):154 """155 Filter the tasks on all the user_classes recursively, according to the tags and156 exclude_tags attributes157 """158 if self.tags is not None:159 self.tags = set(self.tags)160 if self.exclude_tags is not None:161 self.exclude_tags = set(self.exclude_tags)162 for user_class in self.user_classes:...

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