Skip to content

Commit

Permalink
Merge from master
Browse files Browse the repository at this point in the history
  • Loading branch information
mar10 committed Oct 20, 2024
2 parents 8f7ff9d + 34f361f commit aa309e8
Show file tree
Hide file tree
Showing 13 changed files with 1,056 additions and 1,231 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ jobs:
# Python 3.5 # EOL 2020-09-13
# Python 3.6 # EOL 2021-12-21
# Python 3.7 # EOL 2023-06-27
# Python 3.8 # EOL 2024-10-14
# Python 3.9 # EOL 2025-10-05
# Python 3.10 # EOL 2026-10-04
# Python 3.11 # EOL 2027-10-24
# Python 3.12 # EOL 2028-10-02
# Python 3.13 # EOL
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
# Python 3.8 # EOL 2024-10
# Python 3.9 # EOL 2025-10
# Python 3.10 # EOL 2026-10
# Python 3.11 # EOL 2027-10
# Python 3.12 # EOL 2028-10
# Python 3.13 # EOL 2029-10
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -63,4 +64,6 @@ jobs:
# pytest -ra -v -x --durations=10 --cov=wsgidav --html=build/pytest/report-{envname}.html --self-contained-html {posargs}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6 changes: 6 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
3.12
3.13
3.11
3.10
3.9
3.8
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 4.3.4 / Unreleased

- Test with Python 3.13

## 4.3.3 / 2024-05-04

- Deprecate Python 3.8 (EOL: 2024-10-14)
Expand All @@ -22,7 +24,7 @@
responses (default: false).
- #298: `--root` argument honors `fs_dav_provider` configuration.
- #301: `_DAVResource` should have `is_link()` method to avoid dir_browser issues.
- #308: remove defusedxml dependency.
- #308: remove defusedxml.lxml dependency.

## 4.3.0 / 2023-09-24

Expand Down Expand Up @@ -398,7 +400,7 @@ This release contains **BREAKING CHANGES!**

## 0.4.0.b1

- Using HTTP/1.1 with keep-alive (Stéphane KLEIN)
- Using HTTP/1.1 with keep-alive (Stéphane Kein)
- Correctly return pre- and postconditions on lock conflicts.
- Added Sphinx docs
- Added Mercurial provider
Expand Down
1 change: 0 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ PyYAML = "*" # "~=5.1"
json5 = "*"

[requires]
# cx_Freeze 6.x does not yet support Pathon 3.12
python_version = "3.12"

[pipenv]
Expand Down
2,137 changes: 984 additions & 1,153 deletions Pipfile.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions docs/source/THANKS
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Martin Wendt:

* Ho Chun Wei for creating PyFileServer

* St�phane Klein for many contributions and testing on Mac
* Stéphane Klein for many contributions and testing on Mac

* All other contributors:
http://code.google.com/p/wsgidav/people/list
Expand All @@ -24,4 +24,3 @@ Ho Chun Wei, original PyFileServer Project:
* Google's Code Program <http://code.google.com>: For running the Summer of
Code 2005 program to encourage students around the world to contribute
to open source software.

5 changes: 5 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
"sphinx.ext.graphviz",
"sphinx.ext.inheritance_diagram",
"sphinx.ext.napoleon",
'sphinxcontrib.googleanalytics',
'sphinxcontrib.mermaid',
# 'sphinx_automodapi.automodapi',
# 'sphinx_search.extension',
]
Expand Down Expand Up @@ -143,6 +145,9 @@
# html_theme = 'bootstrap'
# html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()

googleanalytics_id = 'G-NESEWWF02Y'
# googleanalytics_enabled = False

# MyST Markdown Support
myst_enable_extensions = [
"dollarmath",
Expand Down
3 changes: 1 addition & 2 deletions docs/source/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ python-pam~=2.0.2
PyYAML~=6.0
# RTD:
furo
# recommonmark~=0.7.1
# MyST
myst-parser[linkify]
sphinxcontrib-googleanalytics
sphinxcontrib-mermaid
46 changes: 2 additions & 44 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ classifiers =
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Topic :: Internet :: WWW/HTTP
Topic :: Internet :: WWW/HTTP :: HTTP Servers
Topic :: Internet :: WWW/HTTP :: Dynamic Content
Expand Down Expand Up @@ -79,7 +80,7 @@ exclude =
[options.package_data]
# * =
# CHANGELOG.md
wsgidav =
wsgidav =
dir_browser/htdocs/*.*


Expand Down Expand Up @@ -134,46 +135,3 @@ addopts =
testpaths =
.
tests

exclude =
__pycache__,
.cache,
.eggs,
.git,
.tox,
.vscode,
build,
dist,
docs

max-line-length = 99
# max-line-length = 88

# 'mccabe' plugin:
# max-complexity = 12

# max-annotations-complexity = 10
# max-expression-complexity = 10

# Ignore some errors that may be created by Black:
# - E203 whitespace before ':'
# - E501 line too long
# - W503 line break before binary operator
# - P101 format string does contain unindexed parameters
# - W605 invalid escape sequence '\/' (we want to allow ascii-art)
# - A003 class attribute "open" is shadowing a python builtin
# - N806 variable 'VAR_NAME' in function should be lowercase
# - B028 'STR' is manually surrounded by quotes, consider using the `!r` conversion flag.
ignore = E203, E501, W503, P101, A003, N806, W605

# Instead of strict E501, enable B950 for relaxed line length checking (and other bugbear warnings)
# select = B,C,D,E,F,I,N,P,PT,Q,S,T,W,B9

#
docstring-convention = all # google?

# Options for the flake8-quotes extension:
inline-quotes = double
multiline-quotes = """
docstring-quotes = """
avoid-escape = True
12 changes: 11 additions & 1 deletion tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,19 @@ def testBasics(self):
assert (
fix_path("a/b", "/root/x", must_exist=False).lower() == r"c:\root\x\a\b"
)
# NOTE:
# Changed in version 3.13: On Windows, `os.path.isabs` returns False
# if the given path starts with exactly one (back)slash.
# So, on n Windows, Python 3.12 and before return "/a/b"
# but on Python 3.13 and later return "c:\a\b"
res = fix_path("/a/b", "/root/x", must_exist=False)
if sys.version_info < (3, 13):
assert res.lower() == r"/a/b"
else:
assert res.lower() == r"c:\a\b"
else:
assert fix_path("a/b", "/root/x", must_exist=False) == "/root/x/a/b"
assert fix_path("/a/b", "/root/x", must_exist=False) == "/a/b"
assert fix_path("/a/b", "/root/x", must_exist=False) == "/a/b"

headers = [("foo", "bar"), ("baz", "qux")]
update_headers_in_place(headers, [("Foo", "bar2"), ("New", "new_val")])
Expand Down
23 changes: 14 additions & 9 deletions tests/test_wsgidav_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
"""
Unit test for wsgidav HTTP request functionality
Unit test for wsgidav HTTP request functionality
This test suite uses webtest.TestApp to send fake requests to the WSGI
stack.
This test suite uses webtest.TestApp to send fake requests to the WSGI
stack.
See http://webtest.readthedocs.org/en/latest/
(successor of http://pythonpaste.org/testing-applications.html)
See http://webtest.readthedocs.org/en/latest/
(successor of http://pythonpaste.org/testing-applications.html)
"""

import shutil
import sys
import unittest
from urllib.parse import quote

import pytest

from tests.util import create_test_folder
from wsgidav import util
from wsgidav.fs_dav_provider import FilesystemProvider
Expand All @@ -30,7 +33,9 @@
file=sys.stderr,
)
print("*" * 70, file=sys.stderr)
raise
raise pytest.skip(
"Skip tests that require WebTest", allow_module_level=True
) from None

# ========================================================================
# ServerTest
Expand Down Expand Up @@ -165,7 +170,7 @@ def testEncoding(self):
uniData = (
"This is a file with special characters:\n"
+ "Umlaute(äöüß)\n"
+ "Euro(\u20AC)\n"
+ "Euro(\u20ac)\n"
+ "Male(\u2642)"
)

Expand Down Expand Up @@ -201,9 +206,9 @@ def unicode_to_url(s):
return quote(s.encode("utf8"))

# äöüß: (part of latin1)
__testrw(unicode_to_url("/file uml(\u00E4\u00F6\u00FC\u00DF).txt"))
__testrw(unicode_to_url("/file uml(\u00e4\u00f6\u00fc\u00df).txt"))
# Euro sign (not latin1, but Cp1252)
__testrw(unicode_to_url("/file euro(\u20AC).txt"))
__testrw(unicode_to_url("/file euro(\u20ac).txt"))
# Male sign (only utf8)
__testrw(unicode_to_url("/file male(\u2642).txt"))

Expand Down
15 changes: 11 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[tox]
z[tox]
basepython = python3.12
envlist =
check
Expand All @@ -9,8 +9,8 @@ envlist =
py311 # EOL 2027-10-24
py310 # EOL 2026-10-04
py39 # EOL 2025-10-05
py38 # EOL 2024-10-14
# Deprecated:
py38 # EOL 2024-10-14
# py37 # EOL 2023-06-27
# py36 # EOL 2021-12-21
# py35 # EOL 2020-09-13
Expand All @@ -20,6 +20,9 @@ envlist =
skip_missing_interpreters = true


; [testenv:py313]
; ignore_outcome = True

[testenv]
usedevelop = True
extras =
Expand All @@ -45,13 +48,14 @@ setenv =
commands =
# Run everything from /tests folder:
python -V
pip install pip install pytest-html==4.0.0rc4
; pip install pytest-html==4.0.0rc4
pip list
# Note: also honors .coveragerc:
pytest -ra -v -x --cov=wsgidav --durations=10 --html=build/pytest/report-{envname}.html --self-contained-html {posargs}
; pytest -ra -v -x --cov=wsgidav --durations=10 {posargs}



[testenv:lxml]
; skip_install = true
deps =
Expand Down Expand Up @@ -140,9 +144,12 @@ description = Build Sphinx documentation (output directory: docs/sphinx-build)
changedir = docs
deps =
sphinx
; recommonmark
furo
readthedocs-sphinx-search
sphinx_rtd_theme
myst-parser[linkify]
sphinxcontrib-googleanalytics
sphinxcontrib-mermaid
commands =
# http://www.sphinx-doc.org/en/master/man/sphinx-build.html
sphinx-build -b html source build
Expand Down
7 changes: 4 additions & 3 deletions wsgidav/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
Miscellaneous support functions for WsgiDAV.
"""

import base64
import calendar
import collections.abc
Expand Down Expand Up @@ -820,7 +821,6 @@ def fix_path(path, root, *, expand_vars=True, must_exist=True, allow_none=True):
Convert path to absolute if required, expand leading '~' as user home dir,
expand %VAR%, $Var, ...
"""
# org_path = path
if path in (None, ""):
if allow_none:
return None
Expand All @@ -836,6 +836,9 @@ def fix_path(path, root, *, expand_vars=True, must_exist=True, allow_none=True):
root = os.path.dirname(config_file)
else:
root = os.getcwd()
# NOTE:
# Changed in version 3.13: On Windows, `os.path.isabs` returns False
# if the given path starts with exactly one (back)slash.
path = os.path.abspath(os.path.join(root, path))

if expand_vars:
Expand All @@ -844,8 +847,6 @@ def fix_path(path, root, *, expand_vars=True, must_exist=True, allow_none=True):
if must_exist and not os.path.exists(path):
raise ValueError(f"Invalid path: {path!r}")

# if org_path != path:
# print(f"fix_path({org_path}) => {path}")
return path


Expand Down

0 comments on commit aa309e8

Please sign in to comment.