Skip to content

Commit

Permalink
Fix test on windows
Browse files Browse the repository at this point in the history
(cherry picked from commit praw-dev/praw@c00ccec)
  • Loading branch information
LilSpazJoekp committed Oct 22, 2023
1 parent e350fb5 commit 40541f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
5 changes: 3 additions & 2 deletions tests/integration/models/reddit/test_subreddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import socket
import sys
from asyncio import TimeoutError
from unittest.mock import AsyncMock, MagicMock

import aiofiles
import pytest
Expand All @@ -11,9 +10,11 @@
from asyncprawcore import BadRequest, Forbidden, NotFound, TooLarge

if sys.version_info < (3, 8):
from asynctest import mock
from asynctest import CoroutineMock as AsyncMock
from asynctest import MagicMock, mock
else:
from unittest import mock
from unittest.mock import AsyncMock, MagicMock

from asyncpraw.const import PNG_HEADER
from asyncpraw.exceptions import (
Expand Down
11 changes: 6 additions & 5 deletions tests/unit/test_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
from pathlib import Path

import pytest

Expand All @@ -24,13 +25,13 @@ def _assert_config_read(environment, mock_config):
del os.environ[env_name]
os.environ[environment] = "/MOCK"

module_dir = os.path.dirname(sys.modules["asyncpraw"].__file__)
environ_path = os.path.join(
"/MOCK", ".config" if environment == "HOME" else "", "praw.ini"
module_dir = Path(sys.modules["asyncpraw"].__file__).parent
environ_path = (
Path("/MOCK") / (".config" if environment == "HOME" else "") / "praw.ini"
)
locations = [
os.path.join(module_dir, "praw.ini"),
environ_path,
str(module_dir / "praw.ini"),
str(environ_path),
"praw.ini",
]

Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[tox]
envlist = py37,py38,py39,py310
skip_missing_interpreters = false
envlist = py37,py38,py39,py310,py311
skipsdist = true

[testenv]
deps =
.[test]
commands =
pytest
extras = dev

0 comments on commit 40541f8

Please sign in to comment.