Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何修复源代码测试失败:FifoDiskQueue_Python_Unit Testing_Scrapy - Fatal编程技术网

Python 如何修复源代码测试失败:FifoDiskQueue

Python 如何修复源代码测试失败:FifoDiskQueue,python,unit-testing,scrapy,Python,Unit Testing,Scrapy,下载了Scrapy 0.16的源代码后,我尝试在Macbook上使用./bin/runtests.sh运行测试。令人惊讶的是,测试失败了。它给出了以下结果:失败(跳过=46,失败=9,成功=887)。 你们有谁遇到过这个问题吗?你怎么修理它 [FAIL] Traceback (most recent call last): File "/Users/lws/Downloads/scrapy-scrapy-7b5310d/scrapy/tests/test_utils_queue.py", l

下载了Scrapy 0.16的源代码后,我尝试在Macbook上使用./bin/runtests.sh运行测试。令人惊讶的是,测试失败了。它给出了以下结果:失败(跳过=46,失败=9,成功=887)。 你们有谁遇到过这个问题吗?你怎么修理它

[FAIL]
Traceback (most recent call last):
  File "/Users/lws/Downloads/scrapy-scrapy-7b5310d/scrapy/tests/test_utils_queue.py", line 128, in test_close_open
    self.assertEqual(q.pop(), 'c')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = None
b = 'c'

[FAIL]
Traceback (most recent call last):
  File "/Users/lws/Downloads/scrapy-scrapy-7b5310d/scrapy/tests/test_utils_queue.py", line 128, in test_close_open
    self.assertEqual(q.pop(), 'c')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = 'e'
b = 'c'

是的,这是scrapy中的一个bug,它似乎并没有在GNU/Linux上表现出来,只是在mac os上表现出来。这是由于FifoDiskQueue将无缓冲文件读取与缓冲文件查找混合在一起

我已经写了一篇文章来解决这个问题和一些其他的兼容性问题。但不确定修复程序何时会发布到新版本中


不过,Scrapy在mac os上的工作没有问题(FifoDiskQueue是默认情况下不使用的替代队列机制)。

拉取请求现在被合并。