Conversation
Contributor
|
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
Collaborator
Author
|
@pyansys-ci-bot LGTM. |
MaxJPRey
reviewed
Oct 25, 2024
Co-authored-by: Maxime Rey <87315832+MaxJPRey@users.noreply.github.com>
MaxJPRey
reviewed
Oct 25, 2024
Collaborator
Author
|
Problems with pyfakefs: Details:tests/test_launcher.py::test_find_ansys_linux[/ansys_inc/v221/ansys/bin/ansys221-22.1-None] Exception in thread Thread-4101:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/threading.py", line 1401, in run
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pytest_memprof.py", line 47, in report_mem
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pytest_memprof.py", line 39, in <lambda>
Exception in thread Thread-4104:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/threading.py", line 1401, in run
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pytest_memprof.py", line 47, in report_mem
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pytest_memprof.py", line 39, in <lambda>
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/psutil/__init__.py", line 2029, in virtual_memory
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/psutil/_pslinux.py", line 428, in virtual_memory
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/psutil/_common.py", line 799, in open_binary
Exception in thread Thread-4105:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/psutil/__init__.py", line 2029, in virtual_memory
Exception in thread Thread-4103:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/threading.py", line 1401, in run
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/psutil/_pslinux.py", line 428, in virtual_memory
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_io.py", line 93, in open
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pytest_memprof.py", line 47, in report_mem
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/psutil/_common.py", line 799, in open_binary
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_open.py", line 105, in fake_open
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pytest_memprof.py", line 39, in <lambda>
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_io.py", line 93, in open
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_open.py", line 105, in fake_open
return self.call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_open.py", line 244, in call
return fake_file_open(
file_object = self._init_file_object(
^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_open.py", line 136, in __call__
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_open.py", line 340, in _init_file_object
self.filesystem.raise_os_error(errno.ENOENT, file_path)
return self.call(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_filesystem.py", line 489, in raise_os_error
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_open.py", line 244, in call
raise OSError(err_no, message, filename)
FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: '/proc/meminfo'
file_object = self._init_file_object(
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_open.py", line 340, in _init_file_object
self.filesystem.raise_os_error(errno.ENOENT, file_path)
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_filesystem.py", line 489, in raise_os_error
raise OSError(err_no, message, filename)
FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: '/proc/meminfo' |
Co-authored-by: Maxime Rey <87315832+MaxJPRey@users.noreply.github.com>
…ymapdl into tests/faking-v150
Collaborator
Author
|
I have tried to add the real directory... and nothing... it seems we do really depend on the system.... I might need.......... ==================================== ERRORS ====================================
_ ERROR at setup of test_find_ansys_linux[/ansys_inc/v221/ansys/bin/ansys221-22.1-None] _
fs = <pyfakefs.fake_filesystem.FakeFilesystem object at 0x7fa980541d10>
@pytest.fixture
def my_fs(fs):
> fs.add_real_directory("/proc", lazy_read=False)
/__w/pymapdl/pymapdl/tests/test_launcher.py:139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/__t/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_filesystem.py:2417: in add_real_directory
self._create_fake_from_real_dir(source_path_str, target_path_str, read_only)
/__t/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_filesystem.py:2431: in _create_fake_from_real_dir
self.add_real_symlink(file_path, os.path.join(new_base, file_entry))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyfakefs.fake_filesystem.FakeFilesystem object at 0x7fa980541d10>
source_path = '/proc/644/cwd', target_path = '/proc/644/cwd'
def add_real_symlink(
self, source_path: AnyPath, target_path: Optional[AnyPath] = None
) -> FakeFile:
"""Create a symlink at `source_path` (or `target_path`, if given) and return
the created :py:class:`FakeFile<pyfakefs.fake_file.FakeFile>` object.
It will point to the same path as the symlink on the real filesystem.
Relative symlinks will point relative to their new location. Absolute symlinks
will point to the same, absolute path as on the real filesystem.
Args:
source_path: The path to the existing symlink.
target_path: If given, the name of the symlink in the fake
filesystem, otherwise, the same as `source_path`.
Returns:
the newly created :py:class:`FakeFile<pyfakefs.fake_file.FakeFile>` object.
Raises:
OSError: if the directory does not exist in the real file system.
OSError: if the symlink could not be created
(see :py:meth:`create_file`).
OSError: if the directory already exists in the fake file system.
"""
source_path_str = make_string_path(source_path) # TODO: add test
source_path_str = self._path_without_trailing_separators(source_path_str)
if not os.path.exists(source_path_str) and not os.path.islink(source_path_str):
self.raise_os_error(errno.ENOENT, source_path_str)
> target = os.readlink(source_path_str)
E FileNotFoundError: [Errno 2] No such file or directory: '/proc/644/cwd'
/__t/Python/3.11.10/x64/lib/python3.11/site-packages/pyfakefs/fake_filesystem.py:2352: FileNotFoundError
_ ERROR at setup of test_find_ansys_linux[/ansys_inc/v222/ansys/bin/mapdl-22.2-None] _
fs = <pyfakefs.fake_filesystem.FakeFilesystem object at 0x7fa980cefe50> |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3509 +/- ##
==========================================
+ Coverage 86.99% 87.03% +0.04%
==========================================
Files 187 187
Lines 14628 14628
==========================================
+ Hits 12725 12732 +7
+ Misses 1903 1896 -7 |
…into tests/faking-v150
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Some test refactoring
Issue linked
NA
Checklist
draftif it is not ready to be reviewed yet.feat: adding new MAPDL command)