How to use print_packages method in Behave

Best Python code snippet using behave

release.py

Source:release.py Github

copy

Full Screen

...84 bump_version(ctx, new_version, version_part=version_part,85 dry_run=dry_run)86 build_packages(ctx, hide=hide)87 packages = ensure_packages_exist(ctx, check_only=True)88 print_packages(packages)89# -- NOT-NEEDED:90# @task(name="register")91# def register_packages(ctx, repo=None, dry_run=False):92# """Register release (packages) in artifact-store/repository."""93# original_ctx = ctx94# if repo is None:95# repo = ctx.project.repo or "pypi"96# if dry_run:97# ctx = DryRunContext(ctx)98# packages = ensure_packages_exist(original_ctx)99# print_packages(packages)100# for artifact in packages:101# ctx.run("twine register --repository={repo} {artifact}".format(102# artifact=artifact, repo=repo))103@task104def upload(ctx, repo=None, dry_run=False, skip_existing=False):105 """Upload release packages to repository (artifact-store)."""106 original_ctx = ctx107 opts = ""108 if repo is None:109 repo = ctx.project.repo or "pypi"110 if dry_run:111 ctx = DryRunContext(ctx)112 if skip_existing:113 opts = "--skip-existing"114 packages = ensure_packages_exist(original_ctx)115 print_packages(packages)116 # ctx.run("twine upload --repository={repo} dist/*".format(repo=repo))117 # 2018-05-05 WORK-AROUND for new https://pypi.org/:118 # twine upload --repository-url=https://upload.pypi.org/legacy /dist/*119 ctx.run("twine upload --repository={repo} {opts} dist/*".format(120 repo=repo, opts=opts))121# -- DEPRECATED: Use RTD instead122# @task(name="upload_docs")123# def upload_docs(ctx, repo=None, dry_run=False):124# """Upload and publish docs.125#126# NOTE: Docs are built first.127# """128# if repo is None:129# repo = ctx.project.repo or "pypi"130# if dry_run:131# ctx = DryRunContext(ctx)132#133# ctx.run("python setup.py upload_docs")134#135# -----------------------------------------------------------------------------136# TASK HELPERS:137# -----------------------------------------------------------------------------138def print_packages(packages):139 print("PACKAGES[%d]:" % len(packages))140 for package in packages:141 package_size = package.stat().st_size142 package_time = package.stat().st_mtime143 print(" - %s (size=%s)" % (package, package_size))144def ensure_packages_exist(ctx, pattern=None, check_only=False):145 if pattern is None:146 project_name = ctx.project.name147 project_prefix = project_name.replace("_", "-").split("-")[0]148 pattern = "dist/%s*" % project_prefix149 packages = list(path_glob(pattern, current_dir="."))150 if not packages:151 if check_only:152 message = "No artifacts found: pattern=%s" % pattern...

Full Screen

Full Screen

pyrpmspecinfo

Source:pyrpmspecinfo Github

copy

Full Screen

1#!/usr/bin/python2# -*- python -*-3# -*- coding: utf-8 -*-4## Copyright (C) 2005 Red Hat, Inc.5## Copyright (C) 2005 Harald Hoyer <harald@redhat.com>6## This program is free software; you can redistribute it and/or modify7## it under the terms of the GNU General Public License as published by8## the Free Software Foundation; either version 2 of the License, or9## (at your option) any later version.10## This program is distributed in the hope that it will be useful,11## but WITHOUT ANY WARRANTY; without even the implied warranty of12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13## GNU General Public License for more details.14## You should have received a copy of the GNU General Public License15## along with this program; if not, write to the Free Software16## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.17"""Parser for RPM Specfiles.18Usage: rpmspecfile.py [-v --verbose] [-l --sections] [-s --section=sectionname] [-n --name] [-p --packages] specfile ...19"""20__author__ = "Harald Hoyer <harald@redhat.com>"21import sys, string, os.path22PYRPMDIR = os.path.dirname(__file__) + "/.."23if not PYRPMDIR in sys.path:24 sys.path.append(PYRPMDIR)25from pyrpm.specfile import RpmSpecFile26def Usage():27 print """%s - Simple Specfile Parser28Usage: %s [-v --verbose] [-l --sections] [-s --section=sectionname] [-n --name] [-p --packages] specfile ...""" % (sys.argv[0], sys.argv[0])29if __name__ == '__main__':30 import getopt31 class BadUsage: pass32 filename = None33 section = None34 cmdline = sys.argv[1:]35 print_name = None36 print_packages = None37 print_sections = None38 try:39 opts, args = getopt.getopt(cmdline, "vhnlps:",40 [41 "verbose",42 "help",43 "packages",44 "name",45 "sections",46 "section=",47 ])48 for opt, val in opts:49 if opt == '-v' or opt == '--verbose':50 #Not used yet: verbose += 151 continue52 if opt == '-s' or opt == '--section':53 section = val54 continue55 if opt == '-n' or opt == '--name':56 print_name = 157 continue58 if opt == '-l' or opt == '--sections':59 print_sections = 160 continue61 if opt == '-p' or opt == '--packages':62 print_packages = 163 continue64 if opt == '-h' or opt == "?" or opt == '--help':65 Usage()66 sys.exit(0)67 raise BadUsage68 except (getopt.error, BadUsage):69 Usage()70 sys.exit(1)71 if len(args) == 0:72 Usage()73 sys.exit(1)74 for filename in args:75 spec = RpmSpecFile(filename)76 if print_name:77 print spec.getName()78 if print_packages:79 print string.join(spec.getPackages(), "\n")80 if print_sections:81 print string.join(spec.getSections(), "\n")82 if section:83 sys.stdout.write(spec.getSection(section))...

Full Screen

Full Screen

test_display.py

Source:test_display.py Github

copy

Full Screen

...30 ("status", "updated")]).values(),31 ]32 return h33def test_empty_list(capsys):34 print_packages([])35 out, err = capsys.readouterr()36 res = unicode("\n".join(["app release downloads manifests",37 "----- --------- ----------- -----------",""]))38 assert out == res39def test_print_packages(package_list, capsys):40 print_packages(package_list)41 out, err = capsys.readouterr()42 res = unicode("\n".join(["app release downloads manifests",43 "----- --------- ----------- -----------",44 "o1/p1 1.4.0 45 kpm\no1/p2 1.4.0 45 kpm", ""]))45 assert out == res46def test_print_empty_deploy_result(capsys):47 print_deploy_result([])48 out, err = capsys.readouterr()49 res = u'\n'.join(["\n", "package release type name namespace status",50 "--------- --------- ------ ------ ----------- --------", ""])51 assert out == res52def test_print_deploy_result(deploy_result, capsys):53 print_deploy_result(deploy_result)54 out, err = capsys.readouterr()...

Full Screen

Full Screen

__yarn_deps.py

Source:__yarn_deps.py Github

copy

Full Screen

...30 raw = cli.Flag(31 names=('r', 'raw'),32 help='List dependenies without fancy formatting.',33 )34 def print_packages(self, config, dev=False, peer=False):35 if dev:36 label = 'Development'37 packages = config['devDependencies']38 elif peer:39 label = 'Peer'40 packages = config['peerDependencies']41 else:42 label = 'Production'43 packages = config['dependencies']44 if not packages:45 return46 packages = yarn.format_versions(packages)47 if self.raw:48 for package in packages:49 print(package)50 return51 yarn.print_label(f'{label} Dependencies:')52 for package in packages:53 print(f' {package}')54 def main(self, pkg='package.json'):55 config = yarn.PackageConfig()56 pkg_file = sh.path(pkg)57 if pkg_file.exists():58 config.load_local(pkg_file)59 else:60 try:61 config.load_remote(pkg)62 except ValueError:63 yarn.print_not_found(pkg)64 return -165 show_all = not (self.dev or self.peer or self.prod)66 if self.prod or show_all:67 self.print_packages(config)68 if self.dev or show_all:69 self.print_packages(config, dev=True)70 if self.peer or show_all:71 self.print_packages(config, peer=True)72if __name__ == '__main__':73 try:74 App.run()75 except KeyboardInterrupt as e:...

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