title: Test coverage in a docker container
body: <p>So I am trying to use the coverage.py tool to measure the code coverage of my Django app, however, I have had 0 success today. Basically, my plan was after running the docker container, to have a process manager execute a <code>.sh</code> file, containing the following 2 lines: <code>coverage run /path/to/manage.py test nameofapp</code> and <code>coverage html -d coverage_html"</code>. The problem is that the html file is not being created and I am basically getting 0 information about the coverage. After entering the docker container using <code>docker exec -it nameofcontainer bash</code> and reading the logs I found the following error: </p>
  
  <pre><code> ----------------------------------------------------------------------
   Ran 12 tests in 0.081s
   OK
   &gt;&gt;&gt; Creating test database for alias 'default'...
   Destroying test database for alias 'default'...
   Traceback (most recent call last):
     File "/usr/bin/coverage", line 9, in &lt;module&gt; load_entry_point('coverage==4.3.4', 'console_scripts', 'coverage')()
     File "/usr/lib/python3.4/site-packages/coverage/cmdline.py", line 756, in main status = CoverageScript().command_line(argv)
     File "/usr/lib/python3.4/site-packages/coverage/cmdline.py", line 483, in command_line return self.do_run(options, args)
     File "/usr/lib/python3.4/site-packages/coverage/cmdline.py", line 641, in do_run self.coverage.save()
     File "/usr/lib/python3.4/site-packages/coverage/control.py", line 742, in save self.data_files.write(self.data, suffix=self.data_suffix)
     File "/usr/lib/python3.4/site-packages/coverage/data.py", line 673, in write data.write_file(filename)
     File "/usr/lib/python3.4/site-packages/coverage/data.py", line 460, in write_file with open(filename, 'w') as fdata:
   PermissionError: [Errno 13] Permission denied: '/.coverage'
  </code></pre>
  
  <p>So after seeing the lack of permissions on /.coverage, I simply added <code>chmod +x /path/to/.coverage</code>, however, this made 0 difference and I yet received the exact same error. I decided to enter the container once more and execute the script myself and to my surprise, it worked flawlessly. So why am I not capable of executing the <code>.sh</code> file using the process manager? Is it because the <code>/.coverage</code> file is created once I run the first coverage command and even tho I added the <code>chmod</code> command I am not really changing the permissions on the file as it still does not exist?</p>