VSCode pytest测试发现失败?

问题描述

由于某些原因,VSCode无法获取我的“ test_ *”文件?

代码如下:

COPY --from=builder /usr/local/share/ca-certificates/myCA.crt /usr/local/share/ca-certificates/myCA.crt
RUN apk add ca-certificates && apk update && update-ca-certificates

我尝试使用CTRL + SHIFT + P并配置测试,但这也失败了,它说:import java.net.*; import java.io.*; import java.util.Properties; public class Test { public static void main(String[] args) throws Exception { new Test().connect(); } public void connect() { try { String url = "https://antoshka.ua/ua/nabir-lakiv-dlya-nigtiv-make-it-real-rusalonka-3-sht6282464.html",proxy = "proxy.mydomain.com",port = "8080"; URL server = new URL(url); Properties systemProperties = System.getProperties(); systemProperties.setProperty("http.proxyHost",proxy); systemProperties.setProperty("http.proxyPort",port); HttpURLConnection connection = (HttpURLConnection)server.openConnection(); connection.connect(); InputStream in = connection.getInputStream(); readResponse(in); } catch(Exception e) { e.printStackTrace(); } } public void readResponse(InputStream is) throws IOException { BufferedInputStream bis = new BufferedInputStream(is); ByteArrayOutputStream buf = new ByteArrayOutputStream(); int result = bis.read(); while(result != -1) { byte b = (byte)result; buf.write(b); result = bis.read(); } System.out.println(buf.toString()); } } import pytest import requests import responses @responses.activate def test_simple(api_key: str,url: str): """Test""" responses.add(responses.GET,url=url+api_key,json={"error": "not found"},status=404) resp = requests.get(url+api_key) assert resp.json() == {"error": "not found"}

在我的设置中,唯一与pytest相关的是:Test discovery failed

这是怎么回事?我的文件以“ test”开头,因此在该文件中我的功能也可以吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)