1
0
mirror of https://github.com/pypiserver/pypiserver synced 2024-11-09 16:45:51 +01:00
Commit Graph

32 Commits

Author SHA1 Message Date
Michał Górny
f740a84539
test: Fix running build in offline test environment (#571)
Fix the `build` calls to use `--no-isolation`, in order to fix
regression in running tests in an offline environment.

Unlike the previous `setup.py` calls, `build` defaults to creating a new
virtual environment to perform the build.  This, in turn, requires
fetching the build dependencies from the Internet, effectively making
the tests error out in an offline environment.  Passing `--no-isolation`
makes `build` use the already-installed host dependencies instead.

Co-authored-by: Mitja O <dmtree.dev@yahoo.com>
2024-06-23 22:44:57 +00:00
Mitja O
2f0a56c380
fix: support Python 3.12 (#539)
* chore: pin explicit Python 3.12

* chore: add a `test-python` for stable Python

* chore: empty commit

* chore: add some FIXMEs

* chore: add `packaging`

* chore(wip): replace `LegacyVersion` with `packaging`'s `parse`

* chore(wip): bypass `strtobool` usage

* chore(wip): `pkg_resources` are deprecated

* chore(wip): naive way to support Python <3.12

* chore(wip): swap import order

* chore(wip): try fixing version check

* chore: add a fixme

* chore(wip): reverse legacy pip check

* chore(wip): legacy pip  check for 9 or lower

* fix: fix the legacy pip check

* chore: small cleanup

* chore(wip): try the `importlib_resources`

* chore: add small comment

* chore(wip): avoid `setup.py` in fixtures

* chore(wip): version-compatible wheel build

* chore: install `build` for `3.8` too

* fix: mypy issues

* chore: fix comments

* fix: more formatting fixes

* fix: mdformat

* fix: pass wrong auth to `failed_auth` test

* chore: cleanup packages before and after test runs

* chore(wip): try to bypass test error

* chore: add a tech debt comment

* chore: undo too many changes

* chore(wip): small debug experiment

* chore(wip): skip some tests

* chore(wip): use nonsense code

* fix(chore): small fix to the nonsense code

* chore(wip): try `--force-reinstall`

* chore: finalize the docker tests
2024-04-01 21:30:02 +02:00
Dmitrii Orlov
cd1e17cc26
fix(setuptools-in-tests): add packages=[] in test setup (#425)
* fix: add `packages=[]` in test setup

* pin setuptools below 62 for tests
2022-03-31 10:09:16 +02:00
Dmitrii Orlov
a10cdcead3 Fix black errors on test_server.py 2022-02-20 21:17:20 +01:00
Matthew Planchard
d868005e1f
Docker improvements (#365)
* Docker improvements

This addresses much of what was brought up in #359. Specifically, it:

- Significantly improves testing for the Docker image, adding a
  `docker/test_docker.py` file using the regular pytest machinery to
  set up and run docker images for testing
- Hopefully addresses a variety of permissions issues, by being explicit
  about what access pypiserver needs and asking for it, only erroring
  if that access is not available
  - Requires RX permissions on `/data` (R to read files, X to list files
    and to be able to cd into the directory. This is important since
    `/data` is the `WORKDIR`)
  - Requires RWX permissions on `/data/packages`, so that we can list
    packages, write packages, and read packages.
  - When running in the default configuration (as root on Linux or
    as the pypiserver-named rootish user on Mac), with no volumes
    mounted, these requirements are all satisfied
  - Volume mounts still must be readable by the pypiserver user (UID
    9898) in order for the container to run. However, we now error early
    if this is not the case, and direct users to a useful issue.
  - If the container is run as a non-root, non-pypiserver user (e.g.
    because someone ran `docker run --user=<user_id>`, we try to run
    pypiserver as that user). Provided that user has access to the
    necessary directories, it should run fine.
- Fixes issues with running help and similar commands
- Updates the Docker image to use `PYPISERVER_PORT` for port
  specification, while still falling back to `PORT` for backwards
  compatibility
- Moves some docker-related things into a `/docker` directory
- Adds a `Makefile` for building a test fixture package sdist and wheel,
  so that test code can call `make mypkg` and not need to worry about it
  potentially building multiple times

The only issue #359 raises that's not addressed here is the one of
running pypiserver in the Docker container using some non-default server
for performance. I would like to do some benchmarking before deciding on
what to do there.
2021-02-06 11:28:15 -06:00
PelleK
4b1bd1c9db
Refactor test_server to increase speed (#354)
I gave test_server.py some much needed attention. This file now take ~30 seconds on my machine to run (down from 130 seconds), and I cleaned up the code a little. Let's see how this goes in CI

Commits:
-------------
* minimize time.sleep, convert to pathlib
* refactor, dry code
* run black

Co-authored-by: Matthew Planchard <mplanchard@users.noreply.github.com>
2020-11-15 15:57:53 -06:00
PelleK
d886bc2eba
Cleanup code to python 3.6 (#342)
* Cleanup setup.py

* remove explicit inheritance from object

* convert most string interpolations to f-strings

Co-authored-by: Pelle Koster <pelle.koster@nginfra.nl>
2020-10-07 20:45:51 -05:00
PelleK
8101cf9192
Run black on codebase (#336)
* run black on codebase

* add black check to travis ci

* add pyproject.toml, revert black on bottle.py

Co-authored-by: Pelle Koster <pelle.koster@nginfra.nl>
2020-10-05 21:04:22 -05:00
Matthew Planchard
91a5ebd8b1
[#265] Resolve issue with non-md5 hashing algorithms (#266) 2019-09-02 14:31:59 -05:00
Matthew Planchard
1375a67c55 CRLF Injection Mitigation
Resolves #237

Previously, we were not running any sort of URL escaping on values
passed in from the client that were used for redirects. This allowed
injection attacks via URL encoded newlines in the original request.

This update ensures that all user-supplied paths that are used as
components of redirects are passed through `urllib.parse.quote()`
(or the python 2 equivalent) prior to being used in a redirect
response.

Also specified 127.0.0.1 rather than 0.0.0.0 (the default) in server
tests to avoid triggering firewall dialogs when testing on MacOS
2019-01-24 17:53:03 -06:00
Matthew Planchard
def22f49a7 another pep8 fn name 2018-11-09 18:46:06 -06:00
Matthew Planchard
410498a059 test_server.py cleanup
Resolves #226

Cleaned up `test_server.py` a bit:

* Call `twine` via `Popen` instead of using their internal API, which
  should help us from having to fix twine tests as often
* Cleaned up fixtures
* Some PEP8 updates and general formatting
* Grouped test fixtures and functions all before the tests themselves
2018-11-09 18:44:41 -06:00
Matthew Planchard
c791d12292 FIX: Fallback URL, remove calls to pip.main
Resolves #205 - pypi.python.org shutting down

* Updated the default fallback URL to `pypi.org/simple` rather than
`pypi.python.org/simple`
* Scrubbed references and links to `pypi.python.org`
* Fixed tests breaking due to the removal of `pip.main()` in pip 10.0 -
see pypa/pip#5080 for more info
2018-06-11 20:31:03 -05:00
Matthew Planchard
1770f3cf93 Updated Tests
In addition to including tests from @jameshiebert with slight
updates, I have also resolved an issue with newer versions of twine,
which require an extra parameter in the calls to `upload` and
`register`.
2017-11-14 11:02:44 -06:00
Matthew Planchard
c0b93bdaef Revert Matrix Auth
This reverts commits 29c1803 c79dd18 568f901 and 3d37c00. This has
resulted in bugs referenced in #175, #179, and #186.
2017-11-14 08:43:49 -06:00
Kyle Hornberg
3d37c00999 Add matrix auth 2017-02-21 16:29:47 -06:00
Matthew Planchard
a05d5a103b Update Tests for New Twine
* Updated .travis.yml to fix PEP 440 warnings
* Fixed twine calls

We were getting test failures on multiple branches in
`test_server.py`. I first investigated a warning message
popping up in every test run:

```
PEP440Warning,
/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/pkg_resources/__init__.py:2510: PEP440Warning: 'setuptools (git-0.4.0)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
```

Moving the installation of setuptools, pip, sphinx, and tox
into the `install` key for Travis resolved that issue, but
`test_server.py` tests were still failing. It turns out that
Twine 1.7.0 added support for SSL cert specification and,
in the process, changed the call signature for the `upload`
and `register` internal methods.

This PR fixes the calls so that they align with Twine's new
function signature. Note that tests now fail on Twine <1.7.0,
so I have also updated the dev requirements file.
2016-07-17 14:35:58 -05:00
Dana Powers
394da3212f upload test requires pypirc to avoid password prompt 2016-05-14 21:43:57 -07:00
Kostis Anagnostopoulos
4f7d7a45a7 test: Increase client-server delay to fix non-deterministic TC fails. 2016-01-19 18:06:56 +01:00
ankostis on tokoti
1e3cfb8f6b test: Increase 1-sec sleep after test-server startup. 2015-12-20 20:33:48 +02:00
Kostis Anagnostopoulos at kilo
1a9b782d96 Readme:FIX license shield.
+ Update py2.5 supported env
2015-09-21 18:28:33 +02:00
Kostis Anagnostopoulos at kilo
eeb8b05fec Increase attempts and logging attempt to research spurious `setup.py
upload` fails (#91)!
2015-09-21 04:07:53 +02:00
Kostis Anagnostopoulos at kilo
d9f746b85f test_server: Add setuptools TCs for register/upload.
+ Register TC checks #91, have to search for spurious fails.
2015-09-21 03:34:27 +02:00
Kostis Anagnostopoulos at kilo
9275aeca01 Add twine-register TCs. 2015-09-20 18:35:11 +02:00
ankostis on tokoti
3676771719 FIX test_server FC!
+ Generate dummy-dists within tests to support running on every 
  platform/py-version.
  + delete pr-generated dummy-wheels.
+ Add forgotten test-packages `twinw`, `passlib`!
+ Update bugfix signing `twine` 1.6.1-->1.6.1.
2015-09-20 11:11:57 +02:00
ankostis on tokoti
4bb758da30 PIP test-server.
+ Rework test_server fictures with ports, pswds, and package-dirs.
+ Increase dep: pip>=7
2015-09-19 02:04:32 +02:00
Kostis Anagnostopoulos
3d172ae546 AMIDST test-server: Add pip install test.
[skip ci]
2015-09-18 20:20:01 +02:00
Kostis Anagnostopoulos
f8056565a8 Enable assert "dist-uploaded" in test_server.
+ Had not to use __future__.unicode_literals!
+ Refactor `test_server` using pytest fictures.
2015-09-18 19:19:04 +02:00
Kostis Anagnostopoulos
5fd1d49a3b Mark test_server failing on py-3.2. 2015-09-18 18:48:53 +02:00
Kostis Anagnostopoulos
43bfc7e5ae FIX centodeps TC missing dist-file from prev 2 commit.
+ Change asserting server without capturing stdout/stderr to avoid lockups.
2015-09-18 18:21:05 +02:00
Kostis Anagnostopoulos
6635d4dd74 test-server: Pin twine to 1.6.0.
+ Update centodep-TC with monkeypatch for `twine<1.6.0`.
2015-09-17 20:20:14 +02:00
Kostis Anagnostopoulos
e32ca3425b Add test_server TCs with twine<-->real process.
+ TC for #82 uploading `dentodeps` package with 200 deps.
2015-09-17 20:04:00 +02:00