wwzeng1 / astroid

A common base representation of python source code for pylint and other projects
https://pylint.readthedocs.io/projects/astroid/en/latest/
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Sweep: test_no_user_warning assumes pip is available #4

Open wwzeng1 opened 7 months ago

wwzeng1 commented 7 months ago

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

python3 -sBm build -w --no-isolation because I'm calling build with --no-isolation I'm using during all processes only locally installed modules install .whl file in </install/prefix> using installer module run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix> build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

Thanks for the report. I guess we could just skip this test if pip is not available.

Try reading test_manager.py

Checklist - [X] Modify `tests/test_manager.py` ✓ https://github.com/wwzeng1/astroid/commit/75180d36d90de01442c9e10c987f86e74a926978 [Edit](https://github.com/wwzeng1/astroid/edit/sweep/test_no_user_warning_assumes_pip_is_avai_eadb0/tests/test_manager.py) - [X] Running GitHub Actions for `tests/test_manager.py` ✓ [Edit](https://github.com/wwzeng1/astroid/edit/sweep/test_no_user_warning_assumes_pip_is_avai_eadb0/tests/test_manager.py)
sweep-ai[bot] commented 7 months ago

🚀 Here's the PR! #8

See Sweep's progress at the progress dashboard!
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: c2f7535828)
Install Sweep Configs: Pull Request

[!TIP] I can email you next time I complete a pull request if you set up your email here!


Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/wwzeng1/astroid/blob/465780a9e3c27455d6f48c7e0b0a6d1686b68b7d/tests/test_modutils.py#L299-L589

Step 2: ⌨️ Coding

--- 
+++ 
@@ -16,6 +16,12 @@

 import astroid
 from astroid import manager, test_utils
+
+try:
+    import pip
+    HAS_PIP = True
+except ImportError:
+    HAS_PIP = False
 from astroid.const import IS_JYTHON, IS_PYPY
 from astroid.exceptions import (
     AstroidBuildingError,
@@ -393,6 +399,8 @@

 class IsolatedAstroidManagerTest(resources.AstroidCacheSetupMixin, unittest.TestCase):
     def test_no_user_warning(self):
+        if not HAS_PIP:
+            pytest.skip("pip is not available in this environment")
         mgr = manager.AstroidManager()
         with warnings.catch_warnings():
             warnings.filterwarnings("error", category=UserWarning)

Ran GitHub Actions for 75180d36d90de01442c9e10c987f86e74a926978:


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/test_no_user_warning_assumes_pip_is_avai_eadb0.


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To recreate the pull request edit the issue title or description. Something wrong? Let us know.

This is an automated message generated by Sweep AI.