-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Simplify testing for new contributors #2568
Conversation
c15b743
to
d827a52
Compare
d827a52
to
3a25846
Compare
Is there any way to see the output of buildkite without being added to the org? A copy/paste would be much appreciated. :) |
@@ -4,4 +4,4 @@ virtualenv R:\.venv | |||
R:\.venv\Scripts\pip install -e . --upgrade --upgrade-strategy=only-if-needed | |||
R:\.venv\Scripts\pipenv install --dev | |||
|
|||
SET RAM_DISK=R:&& SET PYPI_VENDOR_DIR=".\tests\pypi\" && R:\.venv\Scripts\pipenv run pytest -n auto -v tests --tap-stream > report.tap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PYPI_VENDOR_DIR
setting is 100% necessary if you want your tests to pass, I'm not sure why you're removing it??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line handles it when running with just pytest
. https://github.com/pypa/pipenv/blob/master/tests/integration/conftest.py#L71
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty confident that line doesn't actually do anything. Buildkite failures are due to the removal of this setting in the other script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, indeed haha, I must've been running it from the test
directory and the implicit ./pypa
in app.py
worked. I had a different version with more explicitly loaded packages that I must've been thinking of. I'll double test that locally and push.
@@ -4,9 +4,6 @@ | |||
|
|||
set -eo pipefail | |||
|
|||
# Set the PYPI vendor URL for pytest-pypi. | |||
PYPI_VENDOR_DIR="$(pwd)/tests/pypi/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same rules apply. Please leave this setting alone.
Buildkite failures:
|
(also unfortunately there is no way to give you access to this, I have tried to get this sorted but it's above my paygrade) |
Ok, pushed a change to set the package dir explicitly and tested it from It's a bit larger of a change, but it removes the implicit dependency of setting the env var before pytest loads the plugin (which happens before |
@@ -4,51 +4,56 @@ | |||
import requests | |||
from flask import Flask, redirect, abort, render_template, send_file, jsonify | |||
|
|||
PYPI_VENDOR_DIR = os.environ.get('PYPI_VENDOR_DIR', './pypi') | |||
PYPI_VENDOR_DIR = os.path.abspath(PYPI_VENDOR_DIR) | |||
|
|||
app = Flask(__name__) | |||
session = requests.Session() | |||
|
|||
packages = {} | |||
|
|||
|
|||
class Package(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main differences here are:
releases
is now a dict of{"release name": "path to file"}
- a new
json
property that tries to find anapi.json
in any folder containing one of the releases (replaces the implicit package dir injson_for_package
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will allow us to build out testing infrastructure which actually includes testing of the json api, which seems like it might be helpful....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was surprised I didn't have any tests to fix for the pytest-pypi
package itself. 😅
Thanks for your efforts on this, feel free to reach out via your preferred real-time communication channel if you want to solicit specific feedback (I'm available on IRC/slack/whatever really) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are valuable changes, thank you for tackling them and taking the time to explain and rectify some of these challenges. They have been kind of floating at the back of my mind for some time but I haven't had the time to focus on them.
@@ -30,6 +31,8 @@ def check_internet(): | |||
WE_HAVE_INTERNET = check_internet() | |||
|
|||
TESTS_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |||
PYPI_VENDOR_DIR = os.path.join(TESTS_ROOT, 'pypi') | |||
prepare_pypi_packages(PYPI_VENDOR_DIR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes a lot of sense to me.
|
||
|
||
def prepare_packages(path): | ||
"""Add packages in path to the registry.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are so straightforward and so much more readable. I've looked at tackling a lot of this before, basically spent about 5 minutes on it and ducked out because I broke everything... Thank you for the cleanup, this is very easy to follow and the changes are both logical and clear.
@@ -4,51 +4,56 @@ | |||
import requests | |||
from flask import Flask, redirect, abort, render_template, send_file, jsonify | |||
|
|||
PYPI_VENDOR_DIR = os.environ.get('PYPI_VENDOR_DIR', './pypi') | |||
PYPI_VENDOR_DIR = os.path.abspath(PYPI_VENDOR_DIR) | |||
|
|||
app = Flask(__name__) | |||
session = requests.Session() | |||
|
|||
packages = {} | |||
|
|||
|
|||
class Package(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will allow us to build out testing infrastructure which actually includes testing of the json api, which seems like it might be helpful....
I need to make sure VSTS still builds against this before I can merge |
I run the tests on my local Windows machine. One failure:
|
@uranusjr this is the exact same issue i've been showing you with the pythonfinder implementation. It installs the package without creating a virtualenv -- for all intents and purposes there should be a new virtualenv created before we do the installation. I think this all relates to the definition of |
The Project class's implementation is a fucking mess. Avoid that.
I give up. resorted to parsing the virtualenv’s location directly from command output. Much simpler. We’ll deal with the |
Addresses some difficulties encountered when trying to get up to speed contributing to the project.
build
dirs when looking for testsThere are a few more structural decisions that this doesn't address:
pipenv
shadowing global package when bootstrapping (Can't bootstrap development environment #2557)make test
doesn't work