Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: faking-v150 #3509

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open

test: faking-v150 #3509

wants to merge 33 commits into from

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Oct 24, 2024

Description

Some test refactoring

Issue linked

NA

Checklist

@germa89 germa89 requested a review from a team as a code owner October 24, 2024 10:23
@germa89 germa89 requested review from clatapie and pyansys-ci-bot and removed request for a team October 24, 2024 10:23
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@germa89 germa89 self-assigned this Oct 24, 2024
@germa89
Copy link
Collaborator Author

germa89 commented Oct 24, 2024

@pyansys-ci-bot LGTM.

@github-actions github-actions bot added the enhancement Improve any current implemented feature label Oct 24, 2024
Copy link
Contributor

@pyansys-ci-bot pyansys-ci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approving this PR because germa89 said so in here 😬

LGTM

@germa89
Copy link
Collaborator Author

germa89 commented Nov 21, 2024

Problems with pyfakefs:

========================= PyMAPDL Pytest short summary =========================
[FAILED] test_find_ansys_linux[/ansys_inc/v221/ansys/bin/ansys221-22.1-None] - E       FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: '/proc/meminfo'
[FAILED] test_find_ansys_linux[/ansys_inc/v222/ansys/bin/mapdl-22.2-None] - E       FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: '/proc/meminfo'
[FAILED] test_find_ansys_linux[/usr/ansys_inc/v231/ansys/bin/mapdl-23.1-None] - E       FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: '/proc/meminfo'

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'

@github-actions github-actions bot added dependencies maintenance General maintenance of the repo (libraries, cicd, etc) labels Nov 21, 2024
@germa89 germa89 changed the title tests: faking-v150 test: faking-v150 Nov 21, 2024
@germa89
Copy link
Collaborator Author

germa89 commented Nov 21, 2024

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>

@github-actions github-actions bot added the CI/CD Related with CICD, Github Actions, etc label Nov 25, 2024
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.04%. Comparing base (3635824) to head (ba3fa6b).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3509      +/-   ##
==========================================
+ Coverage   86.94%   87.04%   +0.09%     
==========================================
  Files         187      187              
  Lines       14622    14623       +1     
==========================================
+ Hits        12713    12728      +15     
+ Misses       1909     1895      -14     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/CD Related with CICD, Github Actions, etc dependencies enhancement Improve any current implemented feature maintenance General maintenance of the repo (libraries, cicd, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants