<commit_before>#!/usr/bin/env python
import os, sys, subprocess

class Object(object): pass

UNIT = '-u'
INTEGRATION = '-i'
actions = (UNIT, INTEGRATION)

action = sys.argv[1]
assert action in actions, "Expected one of %s" % (", ".join(actions),)
action_name = 'unit' if action == UNIT else 'integration'
args = sys.argv[2:]

cwd = os.getcwd()
kind = os.path.basename(cwd)
kinds = ('python', 'ocaml')
if kind not in kinds:
	kind = None

root = os.path.abspath(os.path.dirname(__file__))
test_dir = os.path.join(root, 'test')

try:
	def run_nose(args):
		if os.environ.get('CI', 'false') == 'true':
			args = args + ['-v']
		subprocess.check_call(['make', '-C', root, 'gup-test-local.xml'])
		subprocess.check_call([
			'0install', 'run', '--command=' + os.environ.get('TEST_COMMAND', 'test'),
			os.path.join(root, 'gup-test-local.xml')] + args)

	subprocess.check_call(['make', '%s-test-pre' % action_name])

	def add_to_env(name, val):
		vals = os.environ.get(name, '').split(os.pathsep)
		vals.insert(0, val)
		os.environ[name] = os.pathsep.join(vals)

	if action == INTEGRATION:
		# run without adding to PATH
		if kind is None:
			exe = os.pathsep.join([os.path.join(cwd, kind, 'bin', 'gup') for kind in kinds])
		else:
			exe = os.path.join(cwd, 'bin', 'gup')
		os.environ['GUP_EXE'] = exe
		run_nose(['-w', test_dir] + args)
	else:
		assert action == UNIT
		add_to_env('PATH', os.path.join(root, 'test/bin'))
		if kind == 'ocaml':
			subprocess.check_call(['./test.byte', '-runner', 'sequential'] + args)
		else:
			add_to_env('PYTHONPATH', os.path.join(root, 'python'))
			run_nose(args)

except subprocess.CalledProcessError: sys.exit(1)<commit_msg>remove unnecessary PYTHONPATH insertion<commit_after>#!/usr/bin/env python
import os, sys, subprocess

class Object(object): pass

UNIT = '-u'
INTEGRATION = '-i'
actions = (UNIT, INTEGRATION)

action = sys.argv[1]
assert action in actions, "Expected one of %s" % (", ".join(actions),)
action_name = 'unit' if action == UNIT else 'integration'
args = sys.argv[2:]

cwd = os.getcwd()
kind = os.path.basename(cwd)
kinds = ('python', 'ocaml')
if kind not in kinds:
	kind = None

root = os.path.abspath(os.path.dirname(__file__))
test_dir = os.path.join(root, 'test')

try:
	def run_nose(args):
		if os.environ.get('CI', 'false') == 'true':
			args = args + ['-v']
		subprocess.check_call(['make', '-C', root, 'gup-test-local.xml'])
		subprocess.check_call([
			'0install', 'run', '--command=' + os.environ.get('TEST_COMMAND', 'test'),
			os.path.join(root, 'gup-test-local.xml')] + args)

	subprocess.check_call(['make', '%s-test-pre' % action_name])

	def add_to_env(name, val):
		vals = os.environ.get(name, '').split(os.pathsep)
		vals.insert(0, val)
		os.environ[name] = os.pathsep.join(vals)

	if action == INTEGRATION:
		# run without adding to PATH
		if kind is None:
			exe = os.pathsep.join([os.path.join(cwd, kind, 'bin', 'gup') for kind in kinds])
		else:
			exe = os.path.join(cwd, 'bin', 'gup')
		os.environ['GUP_EXE'] = exe
		run_nose(['-w', test_dir] + args)
	else:
		assert action == UNIT
		add_to_env('PATH', os.path.join(root, 'test/bin'))
		if kind == 'ocaml':
			subprocess.check_call(['./test.byte', '-runner', 'sequential'] + args)
		else:
			run_nose(args)

except subprocess.CalledProcessError: sys.exit(1)
{'fraction_non_alphanumeric': 0.1930572472594397, 'fraction_numerical': 0.0030450669914738123, 'mean_word_length': 4.315533980582524, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '4762019', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1288, 'n_words': 287}