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 eea44b5 commit 065d4ef
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ classifiers = [
]
dependencies = [
"aiofiles",
"aiohttp <4",
"aiohttp <4; python_version < '3.12'",
"aiohttp==3.9.0b0; python_version == '3.12'",
"aiosqlite <=0.17.0",
"asyncprawcore >=2.1, <3",
"update_checker >=0.18"
Expand Down
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 065d4ef

Please sign in to comment.