CI skip for tests when Cartopy data not accessible
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 66/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
Start with tests/integration/test_advanced_plot_examples.py, especially test_canari_1, and inspect the plotting tests that request Cartopy Natural Earth data. Check how those tests behave when the data fetch fails, then add skips only to the susceptible tests. Done means CI no longer fails solely because Cartopy resources are unreachable, while the affected tests still run when the data is available.
由索引模型根据 Issue 内容生成。
描述
Some tests have been observed to fail on Actions not due to a cf-plot issue but due to inability to fetch Cartopy resources such as the Natural Earth shapefile data to draw the land and ocean shapes notably coastlines etc.
(locally this is cached when obtained at any point so rarely needs to be pulled down but on the CI jobs it needs to be fetched each time).
We should add appropriate skips onto tests which can fail in this way. This will mainly involve investigating which tests are susceptible to this.
Example
As seen on Mac 3.13 job for #161 at commit 9540c18. Only this one test failed somehow which possibly implies the data is being fetched for each plotting call which is a separate (bad for performance) issue in itself (TBC).
=================================== FAILURES ===================================
________________________________ test_canari_1 _________________________________
self = <urllib.request.HTTPSHandler object at 0x14c2fcad0>
http_class = <class 'http.client.HTTPSConnection'>
req = <urllib.request.Request object at 0x14f43fd90>
http_conn_args = {'context': <ssl.SSLContext object at 0x14c2f82d0>}
def do_open(self, http_class, req, **http_conn_args):
"""Return an HTTPResponse object for the request, using http_class.
http_class must implement the HTTPConnection API from http.client.
"""
host = req.host
if not host:
raise URLError('no host given')
# will parse host:port
h = http_class(host, timeout=req.timeout, **http_conn_args)
h.set_debuglevel(self._debuglevel)
headers = dict(req.unredirected_hdrs)
headers.update(req.headers)
# TODO(jhylton): Should this be redesigned to handle
# persistent connections?
# We want to make an HTTP/1.1 request, but the addinfourl
# class isn't prepared to deal with a persistent connection.
# It will try to read all remaining data from the socket,
# which will block while the server waits for the next request.
# So make sure the connection gets closed after the (only)
# request.
headers["Connection"] = "close"
headers = {name.title(): val for name, val in headers.items()}
if req._tunnel_host:
tunnel_headers = {}
proxy_auth_hdr = "Proxy-Authorization"
if proxy_auth_hdr in headers:
tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr]
# Proxy-Authorization should not be sent to origin
# server.
del headers[proxy_auth_hdr]
h.set_tunnel(req._tunnel_host, headers=tunnel_headers)
try:
try:
> h.request(req.get_method(), req.selector, req.data, headers,
encode_chunked=req.has_header('Transfer-encoding'))
../../../../miniconda3/envs/cf-latest/lib/python3.13/urllib/request.py:1331:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../miniconda3/envs/cf-latest/lib/python3.13/http/client.py:1386: in request
self._send_request(method, url, body, headers, encode_chunked)
../../../../miniconda3/envs/cf-latest/lib/python3.13/http/client.py:1432: in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
../../../../miniconda3/envs/cf-latest/lib/python3.13/http/client.py:1381: in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
../../../../miniconda3/envs/cf-latest/lib/python3.13/http/client.py:1141: in _send_output
self.send(msg)
../../../../miniconda3/envs/cf-latest/lib/python3.13/http/client.py:1085: in send
self.connect()
../../../../miniconda3/envs/cf-latest/lib/python3.13/http/client.py:1520: in connect
super().connect()
../../../../miniconda3/envs/cf-latest/lib/python3.13/http/client.py:1051: in connect
self.sock = self._create_connection(
../../../../miniconda3/envs/cf-latest/lib/python3.13/socket.py:844: in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
host = 'naturalearth.s3.amazonaws.com', port = 443, family = 0
type = <SocketKind.SOCK_STREAM: 1>, proto = 0, flags = 0
def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
"""Resolve host and port into list of address info entries.
Translate the host/port argument into a sequence of 5-tuples that contain
all the necessary arguments for creating a socket connected to that service.
host is a domain name, a string representation of an IPv4/v6 address or
None. port is a string service name such as 'http', a numeric port number or
None. By passing None as the value of host and port, you can pass NULL to
the underlying C API.
The family, type and proto arguments can be optionally specified in order to
narrow the list of addresses returned. Passing zero as a value for each of
these arguments selects the full range of results.
"""
# We override this function since we want to translate the numeric family
# and socket type values to enum constants.
addrlist = []
> for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E socket.gaierror: [Errno 8] nodename nor servname provided, or not known
../../../../miniconda3/envs/cf-latest/lib/python3.13/socket.py:983: gaierror
During handling of the above exception, another exception occurred:
@pytest.mark.integration
def test_canari_1():
"""Regression test for CANARI rotated-grid plotting case."""
if not CANARI_DATA_FILE.exists():
pytest.skip(f"Missing integration dataset: {CANARI_DATA_FILE}")
_configure_example_output("canari_1")
flds = cf.read(str(CANARI_DATA_FILE))
f = flds[0]
field = f[0, 3, :, :]
cfp.mapset(proj="rotated")
> cfp.con(field, lines=False)
tests/integration/test_advanced_plot_examples.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cfplot/contour.py:2680: in con
if _render_with_new_xy(f=f, x=x, y=y, kwargs=kwargs):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cfplot/contour.py:1953: in _render_with_new_xy
rendered = _render_ptype6_rotated_pole(
cfplot/rotated_runtime.py:485: in _render_ptype6_rotated_pole
_render_rotated_grid_axes(
cfplot/rotated_runtime.py:139: in _render_rotated_grid_axes
shpfilename = shpreader.natural_earth(
../../../../miniconda3/envs/cf-latest/lib/python3.13/site-packages/cartopy/io/shapereader.py:319: in natural_earth
return ne_downloader.path(format_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../miniconda3/envs/cf-latest/lib/python3.13/site-packages/cartopy/io/__init__.py:226: in path
result_path = self.acquire_resource(target_path, format_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../miniconda3/envs/cf-latest/lib/python3.13/site-packages/cartopy/io/shapereader.py:372: in acquire_resource
shapefile_online = self._urlopen(url)
^^^^^^^^^^^^^^^^^^
../../../../miniconda3/envs/cf-latest/lib/python3.13/site-packages/cartopy/io/__init__.py:264: in _urlopen
return urlopen(url)
^^^^^^^^^^^^
../../../../miniconda3/envs/cf-latest/lib/python3.13/urllib/request.py:189: in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../miniconda3/envs/cf-latest/lib/python3.13/urllib/request.py:489: in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
../../../../miniconda3/envs/cf-latest/lib/python3.13/urllib/request.py:506: in _open
result = self._call_chain(self.handle_open, protocol, protocol +
../../../../miniconda3/envs/cf-latest/lib/python3.13/urllib/request.py:466: in _call_chain
result = func(*args)
^^^^^^^^^^^
../../../../miniconda3/envs/cf-latest/lib/python3.13/urllib/request.py:1379: in https_open
return self.do_open(http.client.HTTPSConnection, req,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <urllib.request.HTTPSHandler object at 0x14c2fcad0>
http_class = <class 'http.client.HTTPSConnection'>
req = <urllib.request.Request object at 0x14f43fd90>
http_conn_args = {'context': <ssl.SSLContext object at 0x14c2f82d0>}
def do_open(self, http_class, req, **http_conn_args):
"""Return an HTTPResponse object for the request, using http_class.
http_class must implement the HTTPConnection API from http.client.
"""
host = req.host
if not host:
raise URLError('no host given')
# will parse host:port
h = http_class(host, timeout=req.timeout, **http_conn_args)
h.set_debuglevel(self._debuglevel)
headers = dict(req.unredirected_hdrs)
headers.update(req.headers)
# TODO(jhylton): Should this be redesigned to handle
# persistent connections?
# We want to make an HTTP/1.1 request, but the addinfourl
# class isn't prepared to deal with a persistent connection.
# It will try to read all remaining data from the socket,
# which will block while the server waits for the next request.
# So make sure the connection gets closed after the (only)
# request.
headers["Connection"] = "close"
headers = {name.title(): val for name, val in headers.items()}
if req._tunnel_host:
tunnel_headers = {}
proxy_auth_hdr = "Proxy-Authorization"
if proxy_auth_hdr in headers:
tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr]
# Proxy-Authorization should not be sent to origin
# server.
del headers[proxy_auth_hdr]
h.set_tunnel(req._tunnel_host, headers=tunnel_headers)
try:
try:
h.request(req.get_method(), req.selector, req.data, headers,
encode_chunked=req.has_header('Transfer-encoding'))
except OSError as err: # timeout error
> raise URLError(err)
E urllib.error.URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
../../../../miniconda3/envs/cf-latest/lib/python3.13/urllib/request.py:1334: URLError
- 主要语言
- Python
- 星标
- 21
- 派生
- 11
- 平均合并
- 2 小时 59 分钟
- 30 天内合并 PR
- 11
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NCAS-CMS/cf-plot 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
dependencies infrastructure installation testing
难度 1/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
enhancement
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
docs enhancement
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
volcengine/OpenViking#8432 ·
维护者通常 1 天内回复
-
Failed chat turns are passed to the follow-up rewrite as completed history可能已有人在做 @hskhyl 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
NVIDIA/auto-ontology#683 · 1 条评论 ·
维护者通常 1 天内回复
-
documentation task
难度 2/5 1-3 小时 新手友好度 62/100
-
Implement parse_url and accept http URLs for Pear backend可能已有人在做 @muskan-creates352 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
fedora-infra/anitya#2231 ·
维护者通常 2 天内回复
-
MarkdownDocSerializer.post_process escapes '\<' to '\<', rendering literal '<' in CommonMark未关闭
难度 2/5 1-3 小时 新手友好度 74/100
docling-project/docling-core#1067 ·
维护者通常 3 天内回复