
import pytest
from cookiecutter import generate
from cookiecutter import exceptions


@pytest.mark.usefixtures("clean_system")
def test_generate_files_nontemplated_exception():
    with pytest.raises(exceptions.NonTemplatedInputDirException):
        generate.generate_files(
            context={'cookiecutter': {'food': 'pizza'}},
            repo_dir='tests/test-generate-files-nontemplated'
        )


from __future__ import unicode_literals
import os
import pytest

from cookiecutter import generate
from cookiecutter import exceptions
from cookiecutter import utils


@pytest.fixture(scope="function")
def clean_system_remove_additional_folders(request, clean_system):
    def remove_additional_folders():
        if os.path.exists('inputpizzä'):
            utils.rmtree('inputpizzä')
        if os.path.exists('inputgreen'):
            utils.rmtree('inputgreen')
        if os.path.exists('inputbinary_files'):
            utils.rmtree('inputbinary_files')
        if os.path.exists('tests/custom_output_dir'):
            utils.rmtree('tests/custom_output_dir')
        if os.path.exists('inputpermissions'):
            utils.rmtree('inputpermissions')
    request.addfinalizer(remove_additional_folders)


@pytest.mark.usefixtures("clean_system_remove_additional_folders")
def test_generate_files_nontemplated_exception():
    with pytest.raises(exceptions.NonTemplatedInputDirException):
        generate.generate_files(
            context={'cookiecutter': {'food': 'pizza'}},
            repo_dir='tests/test-generate-files-nontemplated'
        )

Add teardown specific to the former TestCase class
Add teardown specific to the former TestCase class

  
+ from __future__ import unicode_literals
+ import os
  import pytest
+ 
  from cookiecutter import generate
  from cookiecutter import exceptions
+ from cookiecutter import utils
  
  
+ @pytest.fixture(scope="function")
+ def clean_system_remove_additional_folders(request, clean_system):
+     def remove_additional_folders():
+         if os.path.exists('inputpizzä'):
+             utils.rmtree('inputpizzä')
+         if os.path.exists('inputgreen'):
+             utils.rmtree('inputgreen')
+         if os.path.exists('inputbinary_files'):
+             utils.rmtree('inputbinary_files')
+         if os.path.exists('tests/custom_output_dir'):
+             utils.rmtree('tests/custom_output_dir')
+         if os.path.exists('inputpermissions'):
+             utils.rmtree('inputpermissions')
+     request.addfinalizer(remove_additional_folders)
+ 
+ 
- @pytest.mark.usefixtures("clean_system")
+ @pytest.mark.usefixtures("clean_system_remove_additional_folders")
  def test_generate_files_nontemplated_exception():
      with pytest.raises(exceptions.NonTemplatedInputDirException):
          generate.generate_files(
              context={'cookiecutter': {'food': 'pizza'}},
              repo_dir='tests/test-generate-files-nontemplated'
          )
  
Add teardown specific to the former TestCase class
## Code Before:

import pytest
from cookiecutter import generate
from cookiecutter import exceptions


@pytest.mark.usefixtures("clean_system")
def test_generate_files_nontemplated_exception():
    with pytest.raises(exceptions.NonTemplatedInputDirException):
        generate.generate_files(
            context={'cookiecutter': {'food': 'pizza'}},
            repo_dir='tests/test-generate-files-nontemplated'
        )

## Instruction:
Add teardown specific to the former TestCase class
## Code After:

from __future__ import unicode_literals
import os
import pytest

from cookiecutter import generate
from cookiecutter import exceptions
from cookiecutter import utils


@pytest.fixture(scope="function")
def clean_system_remove_additional_folders(request, clean_system):
    def remove_additional_folders():
        if os.path.exists('inputpizzä'):
            utils.rmtree('inputpizzä')
        if os.path.exists('inputgreen'):
            utils.rmtree('inputgreen')
        if os.path.exists('inputbinary_files'):
            utils.rmtree('inputbinary_files')
        if os.path.exists('tests/custom_output_dir'):
            utils.rmtree('tests/custom_output_dir')
        if os.path.exists('inputpermissions'):
            utils.rmtree('inputpermissions')
    request.addfinalizer(remove_additional_folders)


@pytest.mark.usefixtures("clean_system_remove_additional_folders")
def test_generate_files_nontemplated_exception():
    with pytest.raises(exceptions.NonTemplatedInputDirException):
        generate.generate_files(
            context={'cookiecutter': {'food': 'pizza'}},
            repo_dir='tests/test-generate-files-nontemplated'
        )
