python 单元测试 unittest
django 项目
/usr/bin/env bash -c "arch -x86_64 /Users/jimogangdan/PycharmProjects/data-exchange-platform/venv/bin/python -m unittest -v app_scheduler_job/test.py
报错 ModuleNotFoundError: No module named 'data_exchange_platform'
应当前的目录不是工作目录
import sys
import os
import django
sys.path.insert(0, r"/Users/jimogangdan/PycharmProjects/data-exchange-platform")
os.environ['DJANGO_SETTINGS_MODULE'] = 'data_exchange_platform.settings'
django.setup()
from app_scheduler_job import day_every
if __name__ == '__main__':
print(os.getcwd())
day_every.execute_transformation()
本文来自博客园,作者:vx_guanchaoguo0,转载请注明原文链接:https://www.cnblogs.com/guanchaoguo/p/17415606.html