With some of our inferred build commands we collect test metadata automatically, but that didn't happen for this project. Django 1.9 python 3.5

I am just facing this problem that I am trying to solve since a while. I really need help in it.

With some of our inferred build commands we collect test metadata automatically, but that didn’t happen for this project. Collecting metadata allows us to list the specific failures, and in some cases makes parallel builds more efficient. Here’s how to get it:
For an inferred ruby test command, simply add the necessary formatter gem
Python should work automatically, except for django you’ll need to use django-nose.
For another inferred test runner that you’d like us to add metadata support for, let us know.
For a custom test command, configure your test runner to write a JUnit XML report to a directory in $CIRCLE_TEST_REPORTS - see the docs for more information.

My stack is django 1.9 on python 3.5. I am already using nose. We have some npm tests that we are just ignoring for this moment.

I tried multiple things to get this issue solved and none of them worked. It seems like there is something that I did not do correctly on my yml file.

This is my app.yml file.

version: 3.4.3

  • postgresql


  • coverage run manage.py test
  • coverage html -d $CIRCLE_ARTIFACTS

Not seeing how you are running nose here.

Basically you need to have your test runner output it’s file in xunit format to $CIRCLE_TEST_REPORTS

Your easiest way to do this is to run django-nose, but if you choose to use another let me know the command and I’ll help you get the test metadata out of it.

Ref: https://circleci.com/docs/test-metadata#automatic-test-metadata-collection

I am using django nose. It should be working out of the box. I will try your solution and get back to you though. :smile:

I found https://nose.readthedocs.org/en/latest/plugins/xunit.html It would seem that nose may not output in xunit by default?

Not sure, I’ve only ever used trial.

Hope this helps.

These settings worked for me. It does not work out of the box with django-nose. You need to specify where you want to put test result file.

    version: 3.4.3
    - postgresql
    - mkdir -p $CIRCLE_TEST_REPORTS/
    - python manage.py test --xunit-file=$CIRCLE_TEST_REPORTS/test_result.xml
1 Like

I’ve run into that before, I think some things may have changed with how certain tests run.

You shouldn’t need the - mkdir -p $CIRCLE_TEST_REPORTS/ btw :smile:

Glad you were able to get it working!

1 Like

I’m still getting the warning message even though I’m using nosetests. I tried outputting test_result.xml as @abbad said. I also tried using a django subdirectory (suggested in the docs):

    - mkdir -p $CIRCLE_TEST_REPORTS/django
    - python manage.py test --xunit-file=$CIRCLE_TEST_REPORTS/django/test_result.xml

Not getting HTML output.

For html you need to do something else. I suggest that you read nose documentation, there are different args that you need to specify for html.


Produce HTML coverage information

Produce HTML coverage information in dir

I think circle ci depends on xml format(xunit) to generate meta data.

Hey @abbad thanks for the suggestions. The code below worked. I think I had to specify all the paths because my manage.py is in a subdirectory (youhue/manage.py).

    - mkdir -p $CIRCLE_TEST_REPORTS/django
    - python youhue/manage.py test --settings=config.local --cover-html --with-xunit --xunit-file=$CIRCLE_TEST_REPORTS/django/test_result.xml --cover-html-dir=$CIRCLE_TEST_REPORTS/django