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

feat: refactoring create_temp_dir #3239

Merged
merged 28 commits into from
Jul 17, 2024
Merged

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Jul 2, 2024

Description

Refactoring create_temp_dir and apply to MapdlPool library

Issue linked

Checklist

@germa89 germa89 requested a review from a team as a code owner July 2, 2024 07:50
@germa89 germa89 requested review from clatapie and removed request for a team July 2, 2024 07:50
@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

@github-actions github-actions bot added documentation Documentation related (improving, adding, etc) new feature Request or proposal for a new feature labels Jul 2, 2024
Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 16.66667% with 10 lines in your changes missing coverage. Please review.

Project coverage is 87.12%. Comparing base (6de31cc) to head (a7e8f8f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3239   +/-   ##
=======================================
  Coverage   87.12%   87.12%           
=======================================
  Files          55       55           
  Lines        9768     9768           
=======================================
  Hits         8510     8510           
  Misses       1258     1258           

@germa89 germa89 changed the title Feat: refactoring create_temp_dir feat: refactoring create_temp_dir Jul 2, 2024
@germa89 germa89 changed the title feat: refactoring create_temp_dir feat: refactoring create_temp_dir Jul 2, 2024
src/ansys/mapdl/core/misc.py Outdated Show resolved Hide resolved
tests/test_misc.py Outdated Show resolved Hide resolved
@germa89 germa89 self-assigned this Jul 2, 2024
@germa89 germa89 enabled auto-merge (squash) July 8, 2024 13:28
src/ansys/mapdl/core/misc.py Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the documentation Documentation related (improving, adding, etc) label Jul 12, 2024
@germa89 germa89 disabled auto-merge July 15, 2024 08:22
@github-actions github-actions bot added CI/CD Related with CICD, Github Actions, etc maintenance General maintenance of the repo (libraries, cicd, etc) labels Jul 15, 2024
@github-actions github-actions bot removed CI/CD Related with CICD, Github Actions, etc maintenance General maintenance of the repo (libraries, cicd, etc) labels Jul 16, 2024
@germa89
Copy link
Collaborator Author

germa89 commented Jul 16, 2024

Using NamedTemporaryFile breaks CICD.

@germa89
Copy link
Collaborator Author

germa89 commented Jul 17, 2024

Avoiding use of __del__: pytest-dev/pytest-cov#603

@germa89
Copy link
Collaborator Author

germa89 commented Jul 17, 2024

@Gryfenfer97 for some reason tempfile.NamedTemporaryFile is breaking CICD:

tests/test_commands.py::test_output_listing[prnsol-args0] ERROR          [  1%]
tests/test_commands.py::test_output_listing[presol-args1] RERUN          [  1%]
tests/test_commands.py::test_output_listing[presol-args1] RERUN          [  1%]
tests/test_commands.py::test_output_listing[presol-args1] RERUN          [  1%]
tests/test_commands.py::test_output_listing[presol-args1] ERROR          [  1%]/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/main.py:339: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: _cov, Hook: pytest_runtestloop
DataError: Couldn't use data file '/home/runner/work/pymapdl/pymapdl/.coverage.fv-az1016-19.6296.XIDBhnCx': unable to open database file
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config.hook.pytest_runtestloop(session=session)

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/sqlitedb.py", line 52, in _connect
INTERNALERROR>     self.con = sqlite3.connect(self.filename, check_same_thread=False)
INTERNALERROR> sqlite3.OperationalError: unable to open database file
INTERNALERROR> 
INTERNALERROR> The above exception was the direct cause of the following exception:
INTERNALERROR> 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/main.py", line 285, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/main.py", line 339, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 156, in _multicall
INTERNALERROR>     teardown[0].send(outcome)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pytest_cov/plugin.py", line 339, in pytest_runtestloop
INTERNALERROR>     self.cov_controller.finish()
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pytest_cov/engine.py", line 46, in ensure_topdir_wrapper
INTERNALERROR>     return meth(self, *args, **kwargs)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pytest_cov/engine.py", line 256, in finish
INTERNALERROR>     self.cov.save()
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/control.py", line 785, in save
INTERNALERROR>     data = self.get_data()
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/control.py", line 865, in get_data
INTERNALERROR>     if self._collector.flush_data():
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/collector.py", line 551, in flush_data
INTERNALERROR>     self.covdata.add_lines(self.mapped_file_dict(line_data))
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/sqldata.py", line 123, in _wrapped
INTERNALERROR>     return method(self, *args, **kwargs)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/sqldata.py", line 494, in add_lines
INTERNALERROR>     self._choose_lines_or_arcs(lines=True)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/sqldata.py", line 563, in _choose_lines_or_arcs
INTERNALERROR>     with self._connect() as con:
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/sqldata.py", line 343, in _connect
INTERNALERROR>     self._open_db()
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/sqldata.py", line 286, in _open_db
INTERNALERROR>     self._read_db()
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/sqldata.py", line 290, in _read_db
INTERNALERROR>     with self._dbs[threading.get_ident()] as db:
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/sqlitedb.py", line 88, in __enter__
INTERNALERROR>     self._connect()
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/coverage/sqlitedb.py", line 54, in _connect
INTERNALERROR>     raise DataError(f"Couldn't use data file {self.filename!r}: {exc}") from exc
INTERNALERROR> coverage.exceptions.DataError: Couldn't use data file '/home/runner/work/pymapdl/pymapdl/.coverage.fv-az1016-19.6296.XIDBhnCx': unable to open database file

!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 3 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
=== 1 failed, 23 passed, 5 skipped, 2 errors, 9 rerun in 1173.03s (0:19:33) ====

Reference: nedbat/coveragepy#1303 (comment)

@germa89 germa89 merged commit 396ac7b into main Jul 17, 2024
64 of 66 checks passed
@germa89 germa89 deleted the feat/refactoring-create_temp_dir branch July 17, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Request or proposal for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants