Before I say something, let me show the current project hierarchy. The app name is api
.
── api
│ ├──
│ ├── admin.py
│ ├── apps.py
│ ├── init.py
│ ├── migrations
│ │ ├── 0001_initial.py
│ │ ├── 0002_wallet_customer_id.py
│ │ ├── 0003_auto_20201201_1103.py
│ │ ├── 0004_auto_20201203_0703.py
│ │ ├── 0005_auto_20201207_1355.py
│ │ ├── __init__.py
│ │
│ ├── models.py
│ ├── permissions.py
│ ├── serializers.py
│ ├── stellar.py
│ ├── te_s_ts_bk.py
│ ├── te_sts_2.py
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── debug.log
├── manage.py
└── myapp
├── __init__.py
├── asgi.py
├── settings-local.py
├── settings-remote.py
├── settings.py
├── urls.py
└── wsgi.py
As it was suggested here, I even removed __init__.py
file from the api
app folder, yet having the issue.
My TestCase Class look like below:
class CreateWalletTestCase(APITestCase):
app_id = 0
app = None
def test_create_wallet(self):
response = self.client.post(
'/wallets/',
data={'app_id': self.app_id, 'customer_id': 'A-001'},
**{'HTTP_api_key': 'test-api', 'HTTP_api_secret': 'test-api-password'}
)
data = json.loads(response.content)
self.assertEqual(data['status'], 'OK
When I run as python manage.py test api.CreateWalletTestCase.test_create_wallet
or even python manage.py test CreateWalletTestCase.test_create_wallet
, it generates the error:
ImportError: Failed to import test module: CreateWalletTestCase
Traceback (most recent call last):
File "/usr/local/lib/python3.9/unittest/loader.py", line 154, in loadTestsFromName
module = __import__(module_name)
ModuleNotFoundError: No module named 'api.CreateWalletTestCase'