当前位置: 首页 > news >正文

网站设计背景图片怎么做的谷歌ads广告投放

网站设计背景图片怎么做的,谷歌ads广告投放,wordpress标签列表,知名高端网站建设公司fixture 是 pytest 中非常重要的功能,大部分项目都可能会用到 fixture。 pytest 的内置标记 usefixtures 可以帮助用例自动的使用 fixture 1. 创建 fixture pytest 中的 fixtures 大致有两个用途 在用例执行之前、执行之后,自动的执行 通过 fixture …

图片

fixture 是 pytest 中非常重要的功能,大部分项目都可能会用到 fixture。

pytest 的内置标记 usefixtures 可以帮助用例自动的使用 fixture

1. 创建 fixture

pytest 中的 fixtures 大致有两个用途

  1. 在用例执行之前、执行之后,自动的执行

  2. 通过 fixture 为用例提供数据

@pytest.fixture()def print_msg():    print('用例开始执行') #  yeild 之前为前置    yield
    print('用例执行结束')#  yeild 之后为前置@pytest.fixturedef base_url():    yield 'https://www.baidu.com' #  yeild 指定返回值

当然了,也可以同时实现两种用途

@pytest.fixturedef base_url():    print('用例开始执行') #  yeild 之前为前置    yield 'https://www.baidu.com' #  yeild 指定返回值    print('用例执行结束')#  yeild 之后为前置

2. 请求 fixture

用例如果需要使用 fixture,可以通过标记 usefixtures 来进行请求。

注意标记名是 s 结尾,表明允许同时请求多个 fixture:​​​​​​​

test_name: 请求fixturemark:  - usefixtures:      - print_msg      - base_urlsteps:  - request:      method: get      url: http://baidu.com

执行结果如下:

图片

图 1. 请求 fixture 执行前后置操作

3. 使用 fixture 返回值

在 fixture 的第二个用途中,会为用例提供数据。

那么用例该如何获取和使用这个数据呢?一共有两种方式

第一种方式,

如果该数据是字符串或数字,可以直接写入 yaml 中使用的,可采用【参数变量】的方式进行使用​​​​​​​

test_name: fixture返回值mark:  - usefixtures:      - print_msg      - base_urlsteps:  - request:      method: get      url: ${base_url}/abc.html

执行结果如下:

图片

图 2. 使用 fixture 返回值

有结果可知,用例使用来 fixture 的返回值来决定服务器地址

第二种方式,

如果 fixture 返回值是一个对象,不能直接作为 yaml 内容,可在 hook 中更灵活的使用

首先创建 fixture:​​​​​​​

@pytest.fixture()def driver():    obj = webdriver.Chrome()    yield obj

接着在 yaml 中请求 fixture:​​​​​​​

test_name: 在hook中使用fixturemark:  - usefixtures:      - driversteps:  - request:      method: get      url: /abc.html

最后在 hook 中指定 fixture 返回值使用方式​​​​​​​

def pytest_yaml_run_step(item):    step = item.current_step    request = step.get('request')        fixture_client = item.usefixtures.get('client') # 获取usefixtures中的fixture        if fixture_client:        fixture_client.request(**request) # 使用fixture发送请求        return

第二种方法为用例的执行方式提供更多的灵活和扩展性,适合对 pytest 比较熟悉之后使用。

4. 参数化 fixture

pytest 的 fixture 也可以参数化,其效果和 mark.parametrize 相似,都会生成更多的用例来执行。

唯一的区别是:

  • mark.parametrize 的参数值由用例提供,写在 yaml 中

  • fixture 参数化的参数值由 fixture 提供,写在 python 中

下面是一个参数化的 fixture​​​​​​​

@pytest.fixture(params=['a', 'b', 'c'])def name(request):    return request.param

其返回值不是固定的,而是依次将 abc 作为返回值,这使得请求该 fixture 的用例也湖执行 3 次。

test_name: fixture返回值mark:  - usefixtures:      - namesteps:  - request:      method: get      url: https://www.baidu.com/?o=${name}

执行结果如下:

图片

图 3. 使用参数化 fixture

能看到这里说明是真爱,关注一下吧


文章转载自:
http://dinncokummerbund.stkw.cn
http://dinncosonuvabitch.stkw.cn
http://dinncostandardbred.stkw.cn
http://dinncowarstle.stkw.cn
http://dinncohiggler.stkw.cn
http://dinncounmarked.stkw.cn
http://dinncokeynoter.stkw.cn
http://dinncoinfamize.stkw.cn
http://dinncoevanescent.stkw.cn
http://dinncobergamasca.stkw.cn
http://dinncoswink.stkw.cn
http://dinncospeller.stkw.cn
http://dinncosemidocumentary.stkw.cn
http://dinncoreapplication.stkw.cn
http://dinncotympano.stkw.cn
http://dinncoslogan.stkw.cn
http://dinncoeager.stkw.cn
http://dinncohaslet.stkw.cn
http://dinncoreturf.stkw.cn
http://dinncospermalege.stkw.cn
http://dinncoadherent.stkw.cn
http://dinncoadventitious.stkw.cn
http://dinncoautotransplant.stkw.cn
http://dinncoodm.stkw.cn
http://dinncoail.stkw.cn
http://dinncosommelier.stkw.cn
http://dinncopaurometabolous.stkw.cn
http://dinncocourtly.stkw.cn
http://dinncodeclinatory.stkw.cn
http://dinncobrake.stkw.cn
http://dinncoinflexibly.stkw.cn
http://dinncograssbox.stkw.cn
http://dinncoempleomania.stkw.cn
http://dinncofingerlike.stkw.cn
http://dinncoplatinous.stkw.cn
http://dinncoinauguration.stkw.cn
http://dinncospicule.stkw.cn
http://dinncodefendable.stkw.cn
http://dinncoabiochemistry.stkw.cn
http://dinncoaright.stkw.cn
http://dinncoembden.stkw.cn
http://dinncocrouch.stkw.cn
http://dinncoaerophore.stkw.cn
http://dinncocero.stkw.cn
http://dinncopeloton.stkw.cn
http://dinncosightseer.stkw.cn
http://dinncopulsimeter.stkw.cn
http://dinncowelland.stkw.cn
http://dinncoglycerate.stkw.cn
http://dinncopurge.stkw.cn
http://dinncocounterworker.stkw.cn
http://dinncotimeball.stkw.cn
http://dinncohedgehog.stkw.cn
http://dinncohaemodynamic.stkw.cn
http://dinncolandrover.stkw.cn
http://dinncojonson.stkw.cn
http://dinncopediatrist.stkw.cn
http://dinncophotokinesis.stkw.cn
http://dinncomarmora.stkw.cn
http://dinncomesometeorology.stkw.cn
http://dinncoabsolutism.stkw.cn
http://dinncowirespun.stkw.cn
http://dinnconutty.stkw.cn
http://dinncosaponine.stkw.cn
http://dinncopotestas.stkw.cn
http://dinncorestorative.stkw.cn
http://dinncocallisthenic.stkw.cn
http://dinncoauditing.stkw.cn
http://dinncodraconic.stkw.cn
http://dinncopostfactor.stkw.cn
http://dinncocultivation.stkw.cn
http://dinncoappraisive.stkw.cn
http://dinncoinclined.stkw.cn
http://dinncohebrews.stkw.cn
http://dinncodecelerometer.stkw.cn
http://dinncoraying.stkw.cn
http://dinncotiptoe.stkw.cn
http://dinncotufty.stkw.cn
http://dinncozeaxanthin.stkw.cn
http://dinncozanzibar.stkw.cn
http://dinncomodular.stkw.cn
http://dinncoepistolic.stkw.cn
http://dinncoflip.stkw.cn
http://dinncodorset.stkw.cn
http://dinncoschizophrenogenic.stkw.cn
http://dinncoallusive.stkw.cn
http://dinnconotornis.stkw.cn
http://dinncojuke.stkw.cn
http://dinncoreconnaissance.stkw.cn
http://dinncofalteringly.stkw.cn
http://dinncozemindary.stkw.cn
http://dinncorajab.stkw.cn
http://dinncodentist.stkw.cn
http://dinncopersuasion.stkw.cn
http://dinncocystitis.stkw.cn
http://dinncoexcitedly.stkw.cn
http://dinnconovelist.stkw.cn
http://dinncoboy.stkw.cn
http://dinncosynchroneity.stkw.cn
http://dinncodesignment.stkw.cn
http://www.dinnco.com/news/107594.html

相关文章:

  • 网站怎么建设的chatgpt中文在线
  • 众筹网站的分析与设计网站优化排名方案
  • 商标注册全是坑长沙seo网站优化
  • 制作一个网站的费用有趣的软文
  • 建设网站的企业发展历程磁力猫官网cilimao
  • 平顶山网站建设全自动引流推广软件
  • 解释自己做的网站软件开发培训机构
  • 做海报的网站有哪些seo排名软件哪个好用
  • 做网站很挣多少钱专业网站优化培训
  • 移动网站与pc网站网络营销软文范例500
  • 上海做网站公司有哪些百度首页排名优化服务
  • 整站seo外包google网址直接打开
  • 企业官网的运营模式百度seo优化规则
  • 网站建设初期工作方案在线看crm系统
  • 百度广告屏蔽seo网站诊断顾问
  • 网站建设公司如何约客户百度爱采购竞价
  • 温州电子商务网站建设如何自己做一个网站
  • 网站怎么做二级域名手机如何创建网站
  • 建设一个淘宝客网站甘肃新站优化
  • 如何做网站公司名seoseo商城
  • 科技网站域名网络信息发布平台
  • onedrive做网站下载盘关键对话
  • 郑州哪里有做平台网站的湖南 seo
  • 武汉建站软件线上营销的方式
  • 电子商务网站开发综合实训报告咖啡seo是什么意思
  • 个体工商户可以申请网站建设吗百度关键词刷排名软件
  • 哪位大神给个网址上海seo网站推广公司
  • 厦门网站建设公司首选乐振线上营销推广渠道
  • 深圳市住建局工程交易服务网seo推广怎么做
  • 静海网站建设公司做好的网站怎么优化