Skip to content

Commit

Permalink
Fix "pytest cannot find module": rm __initL__.py, manual sys.path, add
Browse files Browse the repository at this point in the history
pythonpath
  • Loading branch information
trana authored and trana committed Jan 3, 2024
1 parent 80ff102 commit 91d8d80
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 25 deletions.
Empty file removed __init__.py
Empty file.
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Handling DeprecationWarning 'asyncio_mode' default value
[pytest]
asyncio_mode = strict
pythonpath = .
4 changes: 0 additions & 4 deletions tests/advanced_rpc_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import os
import sys

# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(
os.path.dirname(__file__), os.path.pardir)))

import time
import asyncio
from multiprocessing import Process
Expand Down
4 changes: 0 additions & 4 deletions tests/basic_rpc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
import os
import sys

# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(
os.path.dirname(__file__), os.path.pardir)))

import asyncio
from multiprocessing import Process

Expand Down
5 changes: 0 additions & 5 deletions tests/binary_rpc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
import os
import sys

# Add parent path to use local src as package for tests
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
)

import json
from multiprocessing import Process

Expand Down
4 changes: 0 additions & 4 deletions tests/custom_methods_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
import os
import sys

# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(
os.path.dirname(__file__), os.path.pardir)))


# Configurable
PORT = int(os.environ.get("PORT") or "9000")
Expand Down
4 changes: 0 additions & 4 deletions tests/fast_api_depends_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

from websockets.exceptions import InvalidStatusCode

# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(
os.path.dirname(__file__), os.path.pardir)))

from multiprocessing import Process

import pytest
Expand Down
4 changes: 0 additions & 4 deletions tests/trigger_flow_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
import os
import sys

# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(
os.path.dirname(__file__), os.path.pardir)))

from fastapi_websocket_rpc.utils import gen_uid
from fastapi_websocket_rpc.websocket_rpc_endpoint import WebsocketRPCEndpoint
from fastapi_websocket_rpc.websocket_rpc_client import WebSocketRpcClient
Expand Down

0 comments on commit 91d8d80

Please sign in to comment.