search

Home  >  Q&A  >  body text

python - django项目中如何运行test模块?

一般django项目中都有test模块
如何运行test模块

PHPzPHPz2891 days ago362

reply all(3)I'll reply

  • 怪我咯

    怪我咯2017-04-17 18:03:41

    Can you give me the tree directory of the project? Is this a unit test or an integration test?
    You can try:

    • python test-client.py

    • python test-server.py

    • python manage.py test

    Error python: can't open file 'manage.py': [Errno 2] No such file or directory
    You have to switch to the root directory of the project, which is the directory with manage.py.

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 18:03:41

    python manage.py test <app>
    

    Please replace <app> with the app name in your Django. Generally, if the directory name is polls, then it is

    python manage.py test polls

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 18:03:41

    Note that the file name test-server.py is not standardized!

    reply
    0
  • Cancelreply