<commit_before>import os
import sys
import pytest

@pytest.fixture
def test_data_dir(request):
    ## Determine directory where this file lives and return
    ## different paths depending on whether or not this
    ## conftest.py file has been installed
    cur_directory_path = os.path.abspath(os.path.dirname(__file__))

    if sys.prefix in cur_directory_path:
        ## Running from an installed location
        path = os.path.join(sys.prefix, 'data/streamcorpus-pipeline')
    else:
        ## Running not installed
        path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../data'))
    return path<commit_msg>Find test data files in the right place for installed packages.<commit_after>'''py.test hooks for streamcorpus-pipeline.'''
from __future__ import absolute_import
import os
import sys
import sysconfig

import pytest


@pytest.fixture
def test_data_dir(request):
    # Determine directory where this file lives and return
    # different paths depending on whether or not this
    # conftest.py file has been installed
    cur_directory_path = os.path.abspath(os.path.dirname(__file__))

    if cur_directory_path.startswith(os.path.abspath(sys.prefix)):
        # Running from an installed location
        path = os.path.join(sysconfig.get_path('data'),
                            'data/streamcorpus-pipeline')
    else:
        # Running not installed
        path = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                            '../../data'))
    return path
{'fraction_non_alphanumeric': 0.09375, 'fraction_numerical': 0.0, 'mean_word_length': 2.920918367346939, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3734042', 'n_tokens_mistral': 429, 'n_tokens_neox': 432, 'n_words': 123}