草庐IT

test-Info

全部标签

python - 由于 'INFO spawnerr: unknown error making dispatchers for ' app_name' : EACCES',无法使用 nohup 启动服务

我正尝试与supervisor一起启动服务,但我收到一条错误消息INFOspawnerr:unknownerrormakingdispatchersfor'app_name':EACCES这是我的supervisord.conf文件:[supervisord]logfile=/tmp/supervisord.loglogfile_maxbytes=50MB;changethesedependingonhowmanylogslogfile_backups=10;youwanttokeeploglevel=infopidfile=/tmp/supervisord.pidnodaemon=t

python - Pandas 数据框属性错误 : 'DataFrame' object has no attribute 'design_info'

我正在尝试使用statsmodels.formula.apiOLS实现的predict()函数。当我将新数据框传递给函数以获取样本外数据集的预测值时result.predict(newdf)返回以下错误:'DataFrame'objecthasnoattribute“设计信息”。这是什么意思,我该如何解决?完整的回溯是:p=result.predict(newdf)File"C:\Python27\lib\site-packages\statsmodels\base\model.py",line878,inpredictexog=dmatrix(self.model.data.orig

python - 默认跳过测试,除非 py.test 中存在命令行参数

我有一个持续2天的长期测试,我不想将其包含在常规测试运行中。我也不想键入命令行参数,这会在每次常规测试运行时取消选择它和其他测试。当我确实需要时,我更愿意选择默认取消选择的测试。我尝试将测试从test_longrun重命名为longrun并使用命令py.testmytests.py::longrun但这不起作用。 最佳答案 除了上面的pytest_configure解决方案,我还找到了pytest.mark.skipif。你需要将pytest_addoption()放入conftest.pydefpytest_addoption(p

python - 记录更改列表中的 Django-admin : How to display link to object info page instead of edit form ,?

我正在为正在处理的应用程序自定义Django-admin。所以到目前为止,定制是工作文件,添加了一些View。但我是想知道如何将change_list显示中的记录链接更改为显示信息页面而不是更改表单?!在这篇博文中:http://www.theotherblog.com/Articles/2009/06/02/extending-the-django-admin-interface/汤姆说:”您可以通过定义一个函数然后添加my_func.allow_tags=True"我没完全理解!!现在我有配置文件功能,当我点击记录列表中的成员我可以显示它(或添加另一个按钮称为-个人资料-),以及如

Python 文档测试 : skip a test conditionally

我知道如何使用#doctest:+SKIP跳过doctest,但我不知道如何根据运行时条件有时跳过测试.例如:>>>ifos.path.isfile("foo"):...open("foo").readlines()...else:...pass#doctest:+SKIP['hello','world']这就是我想做的事情。我也会接受运行测试的解决方案,但如果不满足条件(即无条件运行测试但修改预期结果),则将预期结果更改为带有回溯的异常。 最佳答案 如果您不想对输出进行测试,您可以返回一个特殊值。让我们调用_skip这个特殊值:如

python - 如果 py.test 的另一个测试失败,我该如何跳过测试?

假设我有这些测试函数:deftest_function_one():assert#etc...deftest_function_two():#shouldonlyruniftest_function_onepassesassert#etc.如何确保test_function_two仅在test_function_one通过时运行(我希望这是可能的)?编辑:我需要这个,因为测试二正在使用测试一验证的属性。 最佳答案 您可以使用名为pytest-dependency的pytest插件.代码可以是这样的:importpytest@pyte

python - py.test : Show local variables in Jenkins

到目前为止,我们通过Jenkins调用py.test。如果测试失败,我们会看到像这样的通常的堆栈跟踪Traceback(mostrecentcalllast):File"/home/u/src/foo/bar/tests/test_x.py",line36,intest_schema_migrationserrors,out))AssertionError:Unknownoutput:["Migrationsfor'blue':",...]如果我能像在Django调试页面中那样看到局部变量(参见https://djangobook.com/wp-content/uploads/figu

python - 没有输出,即使有 `py.test -s`

我想将py.test与hunter结合使用:PYTHONHUNTER="module_startswith='foo'"py.test-s-ktest_bar不幸的是,hunter的输出(trace)不可见。版本:foo_cok_d@aptguettler:~$py.test--versionThisispytestversion3.4.2,importedfrom/home/foo_cok_d/local/lib/python2.7/site-packages/pytest.pycsetuptoolsregisteredplugins:pytest-xdist-1.22.2at/ho

python - 带有 INFO 的 python3.5 垃圾邮件中的 Asyncio

当我在Python3.5中启用异步调试时,我几乎每秒都会收到这样的消息:INFO:asyncio:poll999.470mstook1001.159ms:timeoutINFO:asyncio:poll999.264mstook1001.092ms:timeoutINFO:asyncio:poll999.454mstook1001.059ms:timeout这是重现此问题的最小代码:importasyncioimportlogginglogging.basicConfig(level=logging.DEBUG)loop=asyncio.get_event_loop()loop.set

python - 在 sklearn.cross_validation 中使用 train_test_split 和 cross_val_score 的区别

我有一个包含20列的矩阵。最后一列是0/1标签。数据链接是here.我正在尝试使用交叉验证在数据集上运行随机森林。我使用两种方法来做到这一点:使用sklearn.cross_validation.cross_val_score使用sklearn.cross_validation.train_test_split当我做我认为几乎完全相同的事情时,我得到了不同的结果。为了举例说明,我使用上述两种方法运行双重交叉验证,如下面的代码所示。importcsvimportnumpyasnpimportpandasaspdfromsklearnimportensemblefromsklearn.me