<commit_before>"""Tests for distutils.command.sdist."""
import os
import unittest
import shutil
import zipfile
from os.path import join
import sys

from distutils.command.sdist import sdist
from distutils.core import Distribution
from distutils.tests.test_config import PyPIRCCommandTestCase
from distutils.errors import DistutilsExecError
from distutils.spawn import find_executable

CURDIR = os.path.dirname(__file__)
TEMP_PKG = join(CURDIR, 'temppkg')

SETUP_PY = """
from distutils.core import setup
import somecode

setup(name='fake')
"""

MANIFEST_IN = """
recursive-include somecode *
"""

class sdistTestCase(PyPIRCCommandTestCase):

    def setUp(self):
        PyPIRCCommandTestCase.setUp(self)
        self.old_path = os.getcwd()

    def tearDown(self):
        os.chdir(self.old_path)
        if os.path.exists(TEMP_PKG):
            shutil.rmtree(TEMP_PKG)
        PyPIRCCommandTestCase.tearDown(self)

    def _init_tmp_pkg(self):
        if os.path.exists(TEMP_PKG):
            shutil.rmtree(TEMP_PKG)
        os.mkdir(TEMP_PKG)
        os.mkdir(join(TEMP_PKG, 'somecode'))
        os.mkdir(join(TEMP_PKG, 'dist'))
        # creating a MANIFEST, a package, and a README
        self._write(join(TEMP_PKG, 'MANIFEST.in'), MANIFEST_IN)
        self._write(join(TEMP_PKG, 'README'), 'xxx')
        self._write(join(TEMP_PKG, 'somecode', '__init__.py'), '#')
        self._write(join(TEMP_PKG, 'setup.py'), SETUP_PY)
        os.chdir(TEMP_PKG)
<commit_msg>using super in distutils' sdistTestCase<commit_after>"""Tests for distutils.command.sdist."""
import os
import unittest
import shutil
import zipfile
from os.path import join
import sys

from distutils.command.sdist import sdist
from distutils.core import Distribution
from distutils.tests.test_config import PyPIRCCommandTestCase
from distutils.errors import DistutilsExecError
from distutils.spawn import find_executable

CURDIR = os.path.dirname(__file__)
TEMP_PKG = join(CURDIR, 'temppkg')

SETUP_PY = """
from distutils.core import setup
import somecode

setup(name='fake')
"""

MANIFEST_IN = """
recursive-include somecode *
"""

class sdistTestCase(PyPIRCCommandTestCase):

    def setUp(self):
        super(sdistTestCase, self).setUp()
        self.old_path = os.getcwd()

    def tearDown(self):
        os.chdir(self.old_path)
        if os.path.exists(TEMP_PKG):
            shutil.rmtree(TEMP_PKG)
        super(sdistTestCase, self).tearDown()

    def _init_tmp_pkg(self):
        if os.path.exists(TEMP_PKG):
            shutil.rmtree(TEMP_PKG)
        os.mkdir(TEMP_PKG)
        os.mkdir(join(TEMP_PKG, 'somecode'))
        os.mkdir(join(TEMP_PKG, 'dist'))
        # creating a MANIFEST, a package, and a README
        self._write(join(TEMP_PKG, 'MANIFEST.in'), MANIFEST_IN)
        self._write(join(TEMP_PKG, 'README'), 'xxx')
        self._write(join(TEMP_PKG, 'somecode', '__init__.py'), '#')
        self._write(join(TEMP_PKG, 'setup.py'), SETUP_PY)
        os.chdir(TEMP_PKG)

{'fraction_non_alphanumeric': 0.11564396493594066, 'fraction_numerical': 0.0, 'mean_word_length': 3.6872037914691944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '726024', 'n_tokens_mistral': 1023, 'n_tokens_neox': 1036, 'n_words': 202}