在启动测试套件之前设置 pythonpath [英] setup pythonpath before starting test suite

查看:40
本文介绍了在启动测试套件之前设置 pythonpath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我在运行测试时将 pythonpath 设置为 pybot --pythonpath ~/Test_suite main.robot.

Currently I am setting pythonpath as pybot --pythonpath ~/Test_suite main.robot while running the tests.

我还看到有选项 Set Environment Variable PYTHONPATH ${CURDIR} 可以通过机器人框架进行设置.但它不会在主设置之前运行

I also see there is option Set Environment Variable PYTHONPATH ${CURDIR} to set through robot framework. But it doesn't run before main settings

*** Settings ***
Documentation    Suite description
Resource         settings.robot

下面是settings.robot文件

And below is settings.robot file

*** Settings ***
Resource         keywords/keywords_test.robot
Library          tests.test_1.TestClass

如何在运行套件之前设置pythonpath?

How to setup the pythonpath before running the suite?

推荐答案

你不能为所欲为.所有设置都在运行任何测试或关键字之前处理.您可以从命令行使用 --pythonpath 选项,或在开始测试之前设置环境变量 PYTHONPATH.

You can't do what you want. The settings are all processed before any test or keyword is run. You can use the --pythonpath option from the command line, or set the environment variable PYTHONPATH before starting your test.

这篇关于在启动测试套件之前设置 pythonpath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆