小编Igo*_*bin的帖子

py.test - 在不同目录中收集 2 个 conftest.py 时出错

我们使用py.test。我们尝试将不同的conftest.py文件放在不同的文件夹中以拆分我们的灯具:

tests/api/
??? conftest.py
??? folder1
?   ??? conftest.py
??? folder2
?   ??? conftest.py
Run Code Online (Sandbox Code Playgroud)

但是当运行测试时会出现这个错误:

____ ERROR collecting api/folder1/conftest.py ____
import file mismatch:
imported module 'conftest' has this __file__ attribute:
  /tests/api/folder2/conftest.py
which is not the same as the test file we want to collect:
  /tests/api/folder1/conftest.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
Run Code Online (Sandbox Code Playgroud)

这是为什么?怎么修?

附注。删除__pycache__.pyc没有帮助。

聚苯乙烯。__init__.py每个文件夹中已经存在文件。

python pytest

5
推荐指数
1
解决办法
2593
查看次数

在 WebStorm 中通过 Mocha 运行 WebdriverIO 测试

我想从 WebStorm 装订线(左侧的绿色三角形图标,按行号)运行 WebdriverIO + Mocha 测试。

\n\n

在此输入图像描述

\n\n

但是当我按运行三角形时 - 发生错误:

\n\n
/Users/ilyubin/.nvm/versions/node/v10.15.0/bin/node /Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/bin/_mocha --ui bdd --reporter /Applications/WebStorm.app/Contents/plugins/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js /Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/test/specs/catalog/not.found.page.spec.js --grep "^\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82\xd1\x8b \xd1\x81\xd1\x82\xd1\x80\xd0\xb0\xd0\xbd\xd0\xb8\xd1\x86\xd1\x8b \xd0\xbe\xd1\x88\xd0\xb8\xd0\xb1\xd0\xbe\xd0\xba \xd0\x9f\xd0\xbe\xd0\xb8\xd1\x81\xd0\xba \xd0\xbd\xd0\xb5\xd1\x81\xd1\x83\xd1\x89\xd0\xb5\xd1\x81\xd1\x82\xd0\xb2\xd1\x83\xd1\x8e\xd1\x89\xd0\xb5\xd0\xb3\xd0\xbe \xd0\xb7\xd0\xb0\xd0\xbf\xd1\x80\xd0\xbe\xd1\x81\xd0\xb0$"\n/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/test/specs/catalog/not.found.page.spec.js:1\n(function (exports, require, module, __filename, __dirname) { import {expect} from \'chai\';\n                                                                     ^\n\nSyntaxError: Unexpected token {\n    at new Script (vm.js:79:7)\n    at createScript (vm.js:251:10)\n    at Object.runInThisContext (vm.js:303:10)\n    at Module._compile (internal/modules/cjs/loader.js:657:28)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)\n    at Module.load (internal/modules/cjs/loader.js:599:32)\n    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)\n    at Function.Module._load (internal/modules/cjs/loader.js:530:3)\n    at Module.require (internal/modules/cjs/loader.js:637:17)\n    at require (internal/modules/cjs/helpers.js:22:18)\n    at /Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/lib/mocha.js:324:27\n    at Array.forEach (<anonymous>)\n    at Mocha.loadFiles (/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/lib/mocha.js:321:14)\n …
Run Code Online (Sandbox Code Playgroud)

mocha.js webstorm webdriver-io

3
推荐指数
1
解决办法
1642
查看次数

标签 统计

mocha.js ×1

pytest ×1

python ×1

webdriver-io ×1

webstorm ×1