- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在将我们的测试环境从 Nose 切换到 py.test 以测试 Turbogears2 网络应用程序。
目前,当 Nose 运行时,它会从一个测试配置文件 (test.ini) 中收集信息,该文件包含应用程序所需的所有测试变量。而且它似乎以自动方式执行此操作(我只是运行 nosetests
并且所有内容都已加载)
问题在于无法将 py.test 指向正确的 INI 配置文件,这样我就可以让应用程序加载我需要的变量。
目前,失败点是 pylons.app_globals,它在运行 py.test 时根本不存在(因此一切都失败)。
我已经阅读了 Turbogears 文档,但他们只提到了 Nose/nosetests,没有其他任何内容。
有没有办法能够使用我依赖的测试变量来引导应用程序 py.test ?
最佳答案
就 py.test 的部分而言,你可以实现这样的东西:
# content of conftest.py
def pytest_sessionstart():
# setup resources before any test is executed
def pytest_sessionfinish():
# teardown resources after the last test has executed
这样的 conftest.py 文件目前最好保存在您的结帐根目录中,因为 py-1.3.4 只会在足够早的时候运行此 Hook 。
我也仔细查看了 TurboGears,但没有轻易找到实际加载 test.ini 的机制。如果有人可以提供此信息,我可以更新答案。
HTH。霍尔格
关于python - Turbogears2 和 py.test,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3835078/
关闭。这个问题是opinion-based .它目前不接受答案。 关闭去年。 锁定。这个问题及其答案是 locked因为这个问题离题但具有历史意义。它目前不接受新的答案或互动。 在过去的几年里,我一
我正在考虑是否应该在我的项目中使用 Turbogears 或 Pylons。我知道 Turbogears2 基于 Pylons。 Turbogears 提供了 Pylon 没有的什么? 谢谢。 最佳答
在 TG1 中,您可以通过执行以下操作来更改登录用户: identity.set_current_identity(identity) 是否可以在 TG2 中做类似的事情?好像 repoze.who
是否可以使用 Turbogears 开发网页的移动版本?有人可以给我举一个例子以及它是如何完成的吗? 最佳答案 您可能想看看 tgext.mobilemiddleware它提供了一个 @expose_
我在生产中有一个 postgres 生产数据库(其中包含大量数据)。现在我需要修改 tg-app 的模型以将几个新表添加到数据库中。 我该怎么做?我正在使用 sqlAlchemy。 最佳答案 这总是有
给出一个 Controller 和一个方法,例如: import genshi from pylons import tmpl_context, request, url import re fro
我目前正在从 Django 切换到 Turbogears 2.1,但遇到了一些问题,我在 Turbogears 文档中找不到答案。如果 tg 开发人员读过这篇文章,让我告诉您,Django 相对 TG
我有一个简单的 TurboGears 2 脚本,名为 app.py: #!/usr/bin/env python3 from wsgiref.simple_server import make_ser
在 Turbogears 框架中是否有用于执行广泛的 CRUD(创建-检索-更新-删除)接口(interface)的任何好的包或方法。 FastDataGrid 小部件是一个太多的黑盒子,没有用处,而
我是 TurboGears 的新手,刚刚在虚拟环境中安装了 TG2 开发。我正在关注 quickstart guide , 并通过 成功构建了一个 helloworld paster quicksta
我一直在尝试找出使用 Turbogears 2 管理文件上传的“最佳实践”方法,但到目前为止还没有真正找到任何示例。我已经找到了一种实际上传文件的方法,但我不确定它对我们来说有多可靠。 此外,获取上传
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
所以我以前从未使用过 Turbogears ,但我实习的公司有 Turbogears 来运行他们的 JS 文件。我正在尝试将我的新 JS 代码集成到他们的文件中,但仅调用脚本就会遇到重复的错误,并且想
我是 python 新手,我决定通过开发一个小商店来尝试 TG2。到目前为止,我一直很喜欢它,但我猜我的编码游行仍然非常依赖于 java,例如,我的 CartController 中的 add to
这个问题本质上是两部分。1. 我有一种情况,我要求事物在一起是唯一的,即 db 中的元素需要彼此是唯一的。 假设我们有一个模型 Things(粗糙的伪代码) Class ShoppingList( o
我正在使用turbogears 2.2来编写Web应用程序,它似乎是一个非常强大的框架,但是有很多像身份验证这样的黑匣子,因为我不太了解它们(这里是repoze.who插件)。 要求 用户密码必须保存
我正在使用 Turbogears 2.1 和 repoze.who/what,但在弄清楚如何扩展基本身份验证功能时遇到了问题。我实际上是在尝试要求用户在登录之前通过电子邮件链接激活他们的帐户。如果他们
我有一个 TurboGears 应用程序,我想在 Facebook 上运行,我正在寻找一个使用 pyFacebook 或 minifb.py 的示例 TurboGears 项目。 pyFacebook
作为 Turbogears 新手学习 20wiki 教程 我使用的是win7,python 2.7.2(我猜我的计算机区域设置是希伯来语,但一开始我计划进行英语开发),我认为 Turbogears 版
我有使用 TG 2.2.2 编写的应用程序,具有默认身份验证。最近几天,我在登录和退出时遇到问题。在 safari 中,创建了两个 authtkt cookie,一个为“beta.domain.com
我是一名优秀的程序员,十分优秀!