Python中文
首页
教程
问答
标签
搜索
登录
注册
为什么import *不能运行导入的代码?
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我有一个文件夹,里面有我所有的单元测试。它们都包括:</p> <pre><code>if __name__ == '__main__': unittest.TextTestRunner(verbosity=2).run(suite()) </code></pre> <p>所以为了测试它们,我只需要导入测试脚本。我有一个test-unall脚本,它通过一个接一个地导入单元测试来完成所有的单元测试。当前如下所示:</p> ^{pr2}$ <p>这意味着每当我添加或删除一个新的测试时,我都需要更改导入。所以我想用</p> ^{3}$ <p>但是,这不会运行任何代码。为什么我不输入代码。 另外,如果有人知道一个解决方案(即note nose)来运行所有的单元测试,而不必逐个导入它们,这将是非常好的。在</p> <p>谢谢<br/> 尼克</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>运行所有测试的最简单方法(不使用外部工具)可能是使用<a href="http://docs.python.org/library/unittest.html#unittest.TestLoader.discover" rel="nofollow">TestLoader.discover</a>。在</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
无法使用Django/mongoengine连接到MongoDB(身份验证失败)
7 回答
无法使用Django\u mssql\u后端迁移到外部hos
3 回答
无法使用Django&Python3.4连接到MySql
1 回答
无法使用Django+nginx上载媒体文件
5 回答
无法使用Django1.6导入名称模式
6 回答
无法使用Django1.7和mongodb登录管理站点
3 回答
无法使用Djangoadmin创建项目,进程使用了错误的路径,因为我事先安装了错误的Python
6 回答
无法使用Djangockedi验证CBV中的字段
5 回答
无法使用Djangocketditor上载图像(错误400)
3 回答
无法使用Djangocron进行函数调用
6 回答
无法使用Djangofiler djang上载文件
1 回答
无法使用Djangokronos
6 回答
无法使用Djangomssql provid
9 回答
无法使用Djangomssql连接到带有Django 1.11的MS SQL Server 2016
5 回答
无法使用Djangomssq迁移Django数据库
6 回答
无法使用Djangonox创建用户
8 回答
无法使用Djangopyodb从Django查询SQL Server
2 回答
无法使用Djangopython3ldap连接到ldap
5 回答
无法使用Djangoredis连接到redis
9 回答
无法使用Django中的FK创建新表
3 回答