Skip to content

Commit

Permalink
Merge pull request #84 from geigerzaehler/pathlib-tests
Browse files Browse the repository at this point in the history
Use pathlib in tests and add symlink test
  • Loading branch information
geigerzaehler committed Apr 17, 2024
2 parents 4b62770 + aa05a13 commit e5d8dd2
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 179 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main.yaml
Expand Up @@ -35,11 +35,15 @@ jobs:
- run: poetry run ruff check
- run: poetry run pyright --warnings
- run: poetry run pytest
- run: poetry run coverage xml
- uses: coverallsapp/github-action@v2
if: >
github.event_name == 'pull_request' &&
matrix.python-version == '3.8' &&
matrix.os == 'ubuntu-latest'
with:
# Ignore .coverage, which has limited support from coveralls
file: coverage.xml

build-beets-master:
runs-on: ubuntu-latest
Expand Down
14 changes: 4 additions & 10 deletions beetsplug/alternatives.py
Expand Up @@ -10,7 +10,6 @@
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.


import argparse
import os.path
import threading
Expand Down Expand Up @@ -420,16 +419,11 @@ def item_change_actions(self, item: Item, path: bytes, dest: bytes):
"""Returns the necessary actions for items that were previously in the
external collection, but might require metadata updates.
"""
actions = []

if path != dest:
# The path of the link itself changed
actions.append(Action.MOVE)
elif not util.samefile(path, item.path):
# link target changed
actions.append(Action.MOVE)

return actions
if path != dest or not util.samefile(os.readlink(path), item.path):
return [Action.MOVE]
else:
return []

@override
def update(self, create=None):
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Expand Up @@ -30,6 +30,7 @@ beets = "^1.6.0"

[tool.poetry.group.dev.dependencies]
confuse = "^2.0.1"
coverage = "^7.4.4"
mediafile = "^0.12.0"
mock = "^5.0.2"
pyright = "^1.1.340"
Expand All @@ -40,7 +41,7 @@ typeguard = "^4.1.5"
typing-extensions = "^4.9.0"

[tool.pytest.ini_options]
addopts = "--cov --cov-report=term --cov-report=html"
addopts = "--cov --cov-report=term --cov-report=html --cov-branch"
filterwarnings = [
"error",
"ignore:.*imghdr.*:DeprecationWarning:mediafile",
Expand Down

0 comments on commit e5d8dd2

Please sign in to comment.