Skip to content
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

tests/utils/test_config.py wasn't updated for XDG support #2058

Open
hseg opened this issue Apr 1, 2024 · 0 comments
Open

tests/utils/test_config.py wasn't updated for XDG support #2058

hseg opened this issue Apr 1, 2024 · 0 comments
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed

Comments

@hseg
Copy link

hseg commented Apr 1, 2024

System OS

Linux

Python Version

3.11 (CPython)

Install Source

Arch User Repository (Unofficial)

Install version / commit hash

4.2.5

Expected Behavior vs Actual Behavior

pytest tests/utils/test_config.py should succeed with XDG_DATA_HOME set and "$XDG_DATA_HOME/spotdl" existing (incidentally, shouldn't XDG settings be controlled by the existence of $XDG_DATA_HOME, not $XDG_DATA_HOME/spotdl?)

Steps to reproduce - Ensure to include actual links!

export XDG_DATA_HOME=$(mktemp -d)
mkdir -p "$XDG_DATA_HOME/spotdl"
pytest tests/utils/test_config.py

Traceback

========================================== test session starts ===========================================
platform linux -- Python 3.11.8, pytest-8.1.1, pluggy-1.4.0 -- /usr/bin/python
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(PosixPath('/home/gesh/aur/spotdl/src/spotify-downloader-4.2.5/.hypothesis/examples'))
rootdir: /home/gesh/aur/spotdl/src/spotify-downloader-4.2.5
configfile: pyproject.toml
plugins: cov-4.1.0, hypothesis-6.99.13, asyncio-0.23.6, mock-3.13.0, typeguard-4.2.0, anyio-4.3.0, papis-0.13
asyncio: mode=Mode.AUTO
collected 5 items                                                                                        

tests/utils/test_config.py::test_get_spotdl_path FAILED                                            [ 20%]
tests/utils/test_config.py::test_get_config_path FAILED                                            [ 40%]
tests/utils/test_config.py::test_get_cache_path FAILED                                             [ 60%]
tests/utils/test_config.py::test_get_temp_path FAILED                                              [ 80%]
tests/utils/test_config.py::test_get_config_not_created PASSED                                     [100%]

================================================ FAILURES ================================================
__________________________________________ test_get_spotdl_path __________________________________________

setup = namespace(directory=local('/tmp/pytest-of-gesh/pytest-19/test_get_spotdl_path0'))

    def test_get_spotdl_path(setup):
        """
        Tests that the spotdl path is created if it does not exist.
        """
    
>       assert get_spotdl_path() == Path(setup.directory, ".spotdl")
E       AssertionError: assert PosixPath('/tmp/tmp.bp7iRXblvb/spotdl') == PosixPath('/tmp/pytest-of-gesh/pytest-19/test_get_spotdl_path0/.spotdl')
E        +  where PosixPath('/tmp/tmp.bp7iRXblvb/spotdl') = get_spotdl_path()
E        +  and   PosixPath('/tmp/pytest-of-gesh/pytest-19/test_get_spotdl_path0/.spotdl') = Path(local('/tmp/pytest-of-gesh/pytest-19/test_get_spotdl_path0'), '.spotdl')
E        +    where local('/tmp/pytest-of-gesh/pytest-19/test_get_spotdl_path0') = namespace(directory=local('/tmp/pytest-of-gesh/pytest-19/test_get_spotdl_path0')).directory

tests/utils/test_config.py:23: AssertionError
__________________________________________ test_get_config_path __________________________________________

setup = namespace(directory=local('/tmp/pytest-of-gesh/pytest-19/test_get_config_path0'))

    def test_get_config_path(setup):
        """
        Tests if the path to config file is correct.
        """
    
>       assert get_config_file() == Path(setup.directory, ".spotdl", "config.json")
E       AssertionError: assert PosixPath('/tmp/tmp.bp7iRXblvb/spotdl/config.json') == PosixPath('/tmp/pytest-of-gesh/pytest-19/test_get_config_path0/.spotdl/config.json')
E        +  where PosixPath('/tmp/tmp.bp7iRXblvb/spotdl/config.json') = get_config_file()
E        +  and   PosixPath('/tmp/pytest-of-gesh/pytest-19/test_get_config_path0/.spotdl/config.json') = Path(local('/tmp/pytest-of-gesh/pytest-19/test_get_config_path0'), '.spotdl', 'config.json')
E        +    where local('/tmp/pytest-of-gesh/pytest-19/test_get_config_path0') = namespace(directory=local('/tmp/pytest-of-gesh/pytest-19/test_get_config_path0')).directory

tests/utils/test_config.py:32: AssertionError
__________________________________________ test_get_cache_path ___________________________________________

setup = namespace(directory=local('/tmp/pytest-of-gesh/pytest-19/test_get_cache_path0'))

    def test_get_cache_path(setup):
        """
        Tests if the path to the cache file is correct.
        """
    
>       assert get_cache_path() == Path(setup.directory, ".spotdl", ".spotipy")
E       AssertionError: assert PosixPath('/tmp/tmp.bp7iRXblvb/spotdl/.spotipy') == PosixPath('/tmp/pytest-of-gesh/pytest-19/test_get_cache_path0/.spotdl/.spotipy')
E        +  where PosixPath('/tmp/tmp.bp7iRXblvb/spotdl/.spotipy') = get_cache_path()
E        +  and   PosixPath('/tmp/pytest-of-gesh/pytest-19/test_get_cache_path0/.spotdl/.spotipy') = Path(local('/tmp/pytest-of-gesh/pytest-19/test_get_cache_path0'), '.spotdl', '.spotipy')
E        +    where local('/tmp/pytest-of-gesh/pytest-19/test_get_cache_path0') = namespace(directory=local('/tmp/pytest-of-gesh/pytest-19/test_get_cache_path0')).directory

tests/utils/test_config.py:40: AssertionError
___________________________________________ test_get_temp_path ___________________________________________

setup = namespace(directory=local('/tmp/pytest-of-gesh/pytest-19/test_get_temp_path0'))

    def test_get_temp_path(setup):
        """
        Tests if the path to the temp folder is correct.
        """
    
>       assert get_temp_path() == Path(setup.directory, ".spotdl", "temp")
E       AssertionError: assert PosixPath('/tmp/tmp.bp7iRXblvb/spotdl/temp') == PosixPath('/tmp/pytest-of-gesh/pytest-19/test_get_temp_path0/.spotdl/temp')
E        +  where PosixPath('/tmp/tmp.bp7iRXblvb/spotdl/temp') = get_temp_path()
E        +  and   PosixPath('/tmp/pytest-of-gesh/pytest-19/test_get_temp_path0/.spotdl/temp') = Path(local('/tmp/pytest-of-gesh/pytest-19/test_get_temp_path0'), '.spotdl', 'temp')
E        +    where local('/tmp/pytest-of-gesh/pytest-19/test_get_temp_path0') = namespace(directory=local('/tmp/pytest-of-gesh/pytest-19/test_get_temp_path0')).directory

tests/utils/test_config.py:48: AssertionError
============================================ warnings summary ============================================
../../../../../../usr/lib/python3.11/site-packages/pykakasi/properties.py:8
  /usr/lib/python3.11/site-packages/pykakasi/properties.py:8: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources

../../../../../../usr/lib/python3.11/site-packages/pkg_resources/__init__.py:2868
  /usr/lib/python3.11/site-packages/pkg_resources/__init__.py:2868: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

spotdl/utils/web.py:341
  /home/gesh/aur/spotdl/src/spotify-downloader-4.2.5/spotdl/utils/web.py:341: DeprecationWarning: 
          on_event is deprecated, use lifespan event handlers instead.
  
          Read more about it in the
          [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/).
          
    @router.on_event("shutdown")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================= PASSES =================================================
================================ 4 failed, 1 passed, 3 warnings in 0.58s =================================

Other details

No response

@hseg hseg added the Bug Unexpected problem or unintended behavior that needs to be fixed label Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed
Projects
None yet
Development

No branches or pull requests

1 participant