Skip to content

Commit

Permalink
Merge pull request #155 from Erotemic/dev/1.3.6
Browse files Browse the repository at this point in the history
Dev/1.3.6
  • Loading branch information
Erotemic authored Jun 9, 2024
2 parents 1da8198 + 3e9903d commit fa6a803
Show file tree
Hide file tree
Showing 18 changed files with 930 additions and 150 deletions.
56 changes: 22 additions & 34 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
- name: Checkout source
uses: actions/[email protected]
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v3.0.0
if: runner.os == 'Linux' && matrix.arch != 'auto'
with:
platforms: all
Expand Down Expand Up @@ -183,75 +183,75 @@ jobs:
arch: auto
- python-version: '3.12'
install-extras: tests
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.12'
install-extras: tests
os: windows-latest
arch: auto
- python-version: '3.6'
install-extras: tests,optional
os: windows-latest
os: ubuntu-20.04
arch: auto
- python-version: '3.7'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.8'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.9'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.10'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.11'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.12'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: pypy-3.7
- python-version: pypy-3.9
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.6'
install-extras: tests,optional
os: windows-latest
os: macos-13
arch: auto
- python-version: '3.7'
install-extras: tests,optional
os: windows-latest
os: macos-13
arch: auto
- python-version: '3.8'
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.9'
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.10'
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.11'
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.12'
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: pypy-3.7
- python-version: pypy-3.9
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.6'
install-extras: tests,optional
Expand Down Expand Up @@ -281,19 +281,7 @@ jobs:
install-extras: tests,optional
os: windows-latest
arch: auto
- python-version: pypy-3.7
install-extras: tests,optional
os: windows-latest
arch: auto
- python-version: pypy-3.7
install-extras: tests,optional
os: windows-latest
arch: auto
- python-version: pypy-3.7
install-extras: tests,optional
os: windows-latest
arch: auto
- python-version: pypy-3.7
- python-version: pypy-3.9
install-extras: tests,optional
os: windows-latest
arch: auto
Expand All @@ -304,7 +292,7 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v3.0.0
if: runner.os == 'Linux' && matrix.arch != 'auto'
with:
platforms: all
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@ This project (loosely) adheres to [Semantic Versioning](https://semver.org/spec/

## Version 1.3.6 -

### Added:
* Add `ub.IndexableWalker.diff`

### Fixed:
* `ub.import_module_from_path` now correctly accepts `PathLike` objects.
* `ub.modname_to_modpath` fixed in cases where editable installs use type
annotations in their MAPPING definition.

### Added
* Support for UNIX special permission (suid/sgid/svtx) codes in `Path.chmod`.

### Changed
* Moved windows dependencies from requires to optional. Windows users that make
use of these will need to update their ubelt install or explicitly depend on
them as well.

## Version 1.3.5 - Released 2024-03-20

Expand Down
5 changes: 5 additions & 0 deletions requirements/optional.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ colorama>=0.4.3;platform_system=="Windows"
python_dateutil>=2.8.1

packaging>=21.0

jaraco.windows>=3.9.1;platform_system=="Windows"

# Transative dependency from pydantic>=1.9.1->inflect->jaraco.text->jaraco.windows->ubelt
pydantic<2.0;platform_system=="Windows" and platform_python_implementation == "PyPy"
4 changes: 0 additions & 4 deletions requirements/runtime.txt
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
jaraco.windows>=3.9.1;platform_system=="Windows"

# Transative dependency from pydantic>=1.9.1->inflect->jaraco.text->jaraco.windows->ubelt
pydantic<2.0;platform_system=="Windows" and platform_python_implementation == "PyPy"
43 changes: 36 additions & 7 deletions run_tests.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,47 @@
#!/usr/bin/env python
if __name__ == '__main__':
import sys


def get_this_script_fpath():
import pathlib
try:
fpath = pathlib.Path(__file__)
except NameError:
# This is not being run from a script, thus the developer is doing some
# IPython hacking, so we will assume a path on the developer machine.
fpath = pathlib.Path('~/code/ubelt/run_tests.py').expanduser()
if not fpath.exists():
raise Exception(
'Unable to determine the file path that this script '
'should correspond to')
return fpath


def main():
import pytest
import sys
import os

repo_dpath = get_this_script_fpath().parent

package_name = 'ubelt'
mod_dpath = 'ubelt'
test_dpath = 'tests'
mod_dpath = repo_dpath / 'ubelt'
test_dpath = repo_dpath / 'tests'
config_fpath = repo_dpath / 'pyproject.toml'

pytest_args = [
'--cov-config', 'pyproject.toml',
'--cov-config', os.fspath(config_fpath),
'--cov-report', 'html',
'--cov-report', 'term',
'--durations', '100',
'--xdoctest',
'--cov=' + package_name,
mod_dpath, test_dpath
os.fspath(mod_dpath),
os.fspath(test_dpath)
]
pytest_args = pytest_args + sys.argv[1:]
sys.exit(pytest.main(pytest_args))
ret = pytest.main(pytest_args)
return ret


if __name__ == '__main__':
sys.exit(main())
31 changes: 12 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,25 +206,18 @@ def gen_packages_items():
"requirements/runtime.txt", versions="loose"
)
setupkw["extras_require"] = {
"all": parse_requirements("requirements.txt", versions="loose"),
"tests": parse_requirements("requirements/tests.txt", versions="loose"),
"optional": parse_requirements("requirements/optional.txt", versions="loose"),
"all": parse_requirements("requirements.txt", versions="loose"),
"runtime": parse_requirements("requirements/runtime.txt", versions="loose"),
"tests": parse_requirements("requirements/tests.txt", versions="loose"),
"optional": parse_requirements("requirements/optional.txt", versions="loose"),
"docs": parse_requirements("requirements/docs.txt", versions="loose"),
"types": parse_requirements("requirements/types.txt", versions="loose"),
"all-strict": parse_requirements("requirements.txt", versions="strict"),
"runtime-strict": parse_requirements(
"requirements/runtime.txt", versions="strict"
),
"tests-strict": parse_requirements("requirements/tests.txt", versions="strict"),
"optional-strict": parse_requirements(
"requirements/optional.txt", versions="strict"
),
"docs-strict": parse_requirements("requirements/docs.txt", versions="strict"),
"types-strict": parse_requirements("requirements/types.txt", versions="strict"),
"all" : parse_requirements("requirements.txt", versions="loose"),
"all-strict" : parse_requirements("requirements.txt", versions="strict"),
"docs" : parse_requirements("requirements/docs.txt", versions="loose"),
"docs-strict" : parse_requirements("requirements/docs.txt", versions="strict"),
"optional" : parse_requirements("requirements/optional.txt", versions="loose"),
"optional-strict" : parse_requirements("requirements/optional.txt", versions="strict"),
"runtime" : parse_requirements("requirements/runtime.txt", versions="loose"),
"runtime-strict" : parse_requirements("requirements/runtime.txt", versions="strict"),
"tests" : parse_requirements("requirements/tests.txt", versions="loose"),
"tests-strict" : parse_requirements("requirements/tests.txt", versions="strict"),
"types" : parse_requirements("requirements/types.txt", versions="loose"),
"types-strict" : parse_requirements("requirements/types.txt", versions="strict"),
}
setupkw["name"] = NAME
setupkw["version"] = VERSION
Expand Down
11 changes: 11 additions & 0 deletions tests/test_editable_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,20 @@ def teardown_module(module):

def test_import_of_editable_install():
_check_skip_editable_module_tests()
print('Testing ediable installs')
import ubelt as ub
for PROJ in GLOBAL_PROJECTS:
result = ub.modname_to_modpath(PROJ.mod_name)
print(f'result={result}')
assert result is not None
assert PROJ.mod_dpath == ub.Path(result)


if __name__ == '__main__':
"""
CommandLine:
UBELT_DO_EDITABLE_TESTS=1 python ~/code/ubelt/tests/test_editable_modules.py
"""
setup_module(None)
test_import_of_editable_install()
teardown_module(None)
37 changes: 37 additions & 0 deletions tests/test_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,25 @@
import pytest
import os
from ubelt import util_links
import sys


if sys.platform.startswith('win32'):
try:
import jaraco.windows.filesystem as jwfs
except ImportError:
jwfs = None


def test_rel_dir_link():
"""
xdoctest ~/code/ubelt/tests/test_links.py test_rel_dir_link
"""
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.

dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_rel_dir_link').ensuredir()
ub.delete(dpath, verbose=2)
ub.ensuredir(dpath, verbose=2)
Expand Down Expand Up @@ -64,6 +77,10 @@ def test_rel_dir_link():


def test_rel_file_link():
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_rel_file_link').ensuredir()
ub.delete(dpath, verbose=2)
ub.ensuredir(dpath, verbose=2)
Expand Down Expand Up @@ -119,6 +136,10 @@ def test_delete_symlinks():
CommandLine:
python -m ubelt.tests.test_links test_delete_symlinks
"""
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.
# TODO: test that we handle broken links
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_delete_links').ensuredir()

Expand Down Expand Up @@ -224,6 +245,10 @@ def assert_broken_link(path, want=True):


def test_modify_directory_symlinks():
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_modify_symlinks').ensuredir()
ub.delete(dpath, verbose=2)
ub.ensuredir(dpath, verbose=2)
Expand Down Expand Up @@ -283,6 +308,10 @@ def test_modify_file_symlinks():
CommandLine:
python -m ubelt.tests.test_links test_modify_symlinks
"""
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.
# TODO: test that we handle broken links
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_modify_symlinks').ensuredir()
happy_fpath = dpath / 'happy_fpath.txt'
Expand All @@ -306,6 +335,10 @@ def test_broken_link():
CommandLine:
python -m ubelt.tests.test_links test_broken_link
"""
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_broken_link').ensuredir()

ub.delete(dpath, verbose=2)
Expand Down Expand Up @@ -370,6 +403,10 @@ def test_overwrite_symlink():
CommandLine:
python ~/code/ubelt/tests/test_links.py test_overwrite_symlink
"""
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.

# TODO: test that we handle broken links
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_overwrite_symlink').ensuredir()
Expand Down
4 changes: 4 additions & 0 deletions tests/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ def test_move_to_nested_non_existing():
base = _demo_directory_structure()
root = base / 'root'

import platform
if ub.WIN32 and platform.python_implementation() == 'PyPy':
ub.util_path._patch_win32_stats_on_pypy()

if ub.LINUX:
root2 = root.copy(root.augment(tail='2'))
root3 = root.copy(root.augment(tail='3'))
Expand Down
Loading

0 comments on commit fa6a803

Please sign in to comment.