File tree Expand file tree Collapse file tree 3 files changed +41
-2
lines changed
src/ansys/mapdl/core/examples Expand file tree Collapse file tree 3 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -43,3 +43,24 @@ Here are a series of examples using MAPDL with ``ansys-mapdl-core``.
4343.. include :: extended_examples/index.rst
4444 :start-line: 2
4545
46+
47+ .. === DOWNLOAD EXAMPLES ===
48+
49+ .. _ref_download_files :
50+
51+ Download Example Files
52+ ======================
53+
54+ Each example should contain all the necessary resources to run the example.
55+ However in some cases, external files are needed. A link to those files is
56+ available at each example page.
57+ These links refers to the following GitHub repository where you can find all of them:
58+
59+ `GitHub Example Data Repository <https://github.com/pyansys/example-data >`_
60+
61+ If you find out a missing or broken link, please open an issue in
62+ Github (`PyMAPDL Issues <https://github.com/pyansys/pymapdl/issues >`_)
63+ or email us at `
PyAnsys Support <
[email protected] >`_.
64+
65+
66+
Original file line number Diff line number Diff line change @@ -56,7 +56,17 @@ def _retrieve_file(url, filename):
5656
5757def _download_file (filename , directory = None ):
5858 url = _get_file_url (filename , directory )
59- return _retrieve_file (url , filename )
59+ try :
60+ return _retrieve_file (url , filename )
61+ except Exception as e : # Genering exception
62+ raise RuntimeError (
63+ "For the reason mentioned below, retrieving the file from internet failed.\n "
64+ "You can download this file from:\n "
65+ f"{ url } \n "
66+ "\n "
67+ "The reported error message is:\n "
68+ f"{ str (e )} "
69+ )
6070
6171
6272def download_bracket ():
Original file line number Diff line number Diff line change 11import os
22import re
33
4+ import pytest
5+
46from ansys .mapdl .core import examples
5- from ansys .mapdl .core .examples .downloads import download_example_data
7+ from ansys .mapdl .core .examples .downloads import _download_file , download_example_data
68
79
810def test_load_verif ():
@@ -25,3 +27,9 @@ def test_bracket(mapdl, cleared):
2527def test_download_example_data ():
2628 path = download_example_data ("LatheCutter.anf" , "geometry" )
2729 assert os .path .exists (path )
30+
31+
32+ def test_failed_download ():
33+ filename = "non_existing_file"
34+ with pytest .raises (RuntimeError ):
35+ _download_file (filename , directory = None )
You can’t perform that action at this time.
0 commit comments