Problem Description:
Use pytest.main([‘TestcasePairValue.py’]) to execute OK in the case code, but use pytest TestcasePairValue.py under cmd to execute the error as follows
Importing the while Test Module1 ImportError ‘D: \ code \ APITEST \ TestCase \ TestcasePairValue.py’.
Hint: the make your Test modules Sure / Packages have have Valid
I checked the online information and said that there was a circular reference, but I checked the two files and did not see where there is mutual reference. Finally, I found a solution to the big problem. Record it:
Create a new conftest.py file in the executed case file directory, and write the content:
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
Get it done! It can be executed on the console normally!
Read More:
- [Solved] graphviz Error: failed to execute [‘dot’, ‘-Tsvg’], make sure the Graphviz executables are on your systems’ PATH
- Creating test database for alias ‘postgres’… Got an error creating the test database: permission
- [Solved] Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest FAILED和cannot install, GOBIN must be an ab
- [Solved] Using `babel-preset-react-app` requires that you specify `NODE_ENV` or `BABEL_ENV` environment variables. Valid values are “development”, “test”, and “production”. Instead, received: undefined.
- [Solved] catkin_make Error: Invoking “make -j12 -l12“ failed
- [Solved] There are test failures. Please refer to D:\Java_study\springboot\springboot-sugon-3\target\surefire-reports for the individual test results.
- ArchLinux starts error after modifying MariaDB database path Can’t create test file /xxxxx/xxxxx-test
- Error: an error occurred while performing the step: “building kernel modules”. See/var/log/NV
- [Solved] Install nginx make & make install error report record
- [Solved] UE4 Android Package Error: cmd.exe failed with args
- DB::Exception: test: Authentication failed: [How to Solve]
- jmeter Execute to create Chart Error: An error occurred: Error while processing samples: Mismatch between ……
- How to Solve golang test Error: # command-line-arguments [command-line-arguments.test]
- Dubbo Error: HTTP method names must be tokens
- [Solved] R Language Error: duplicate ‘row.names’ are not allowed
- [Solved] Canoe CAPL Error: “the test module is not assigned or invalid”
- [Solved] ERROR: ./depthai_sdk is not a valid editable requirement.
- [Solved] Error: Undefined symbol DMA_Cmd (referred from dac.o)
- Start failure: spawn CMD enoent error (How to Fix)
- [Solved] SHELL Run Error: “-BASH: ./TEST.SH: /BIN/BASH^M: BAD INTERPRETER: NO SUCH FILE OR DIRECTORY”