<commit_before>package rpm

import (
	"fmt"
	"github.com/rkcpi/vell/config"
	"os"
	"testing"
	"time"
)

var repo YumRepository
var path string

func setup() {
	name := fmt.Sprintf("vell-repository-%v", time.Now().Unix())
	repo = YumRepository{name}
	config.ReposPath = "/tmp/"
	path = "/tmp/" + name
}

func TestPath(t *testing.T) {

	if p := repo.path(); p != path {
		t.Errorf("Expected %s, but got %s", path, p)
	}
}

func TestEnsureExists(t *testing.T) {
	repo.ensureExists()
	file, err := os.Open(path)
	if err != nil {
		t.Errorf("%s", err)
	}
	fileInfo, err := file.Stat()
	if err != nil {
		t.Errorf("%s", err)
	}
	if !fileInfo.IsDir() {
		t.Errorf("%s is not a directory", path)
	}
	if perm := fileInfo.Mode().Perm(); perm != 0755 {
		t.Errorf("%s has wrong permissions: %s (expected %s)", path, perm, 0755)
	}
}

func TestMain(m *testing.M) {
	setup()
	code := m.Run()
	shutdown()
	os.Exit(code)
}

func shutdown() {}
<commit_msg>repo, revise test to use proper path handling<commit_after>package rpm

import (
	"github.com/rkcpi/vell/config"
	"io/ioutil"
	"os"
	"path/filepath"
	"testing"
)

var repo YumRepository
var path string

func setup() {
	name := "vell-repository"
	repo = YumRepository{name}
	config.ReposPath, _ = ioutil.TempDir("", "vell")
	path = filepath.Join(config.ReposPath, name)
}

func TestPath(t *testing.T) {

	if p := repo.path(); p != path {
		t.Errorf("Expected %s, but got %s", path, p)
	}
}

func TestEnsureExists(t *testing.T) {
	repo.ensureExists()
	file, err := os.Open(path)
	if err != nil {
		t.Errorf("%s", err)
	}
	fileInfo, err := file.Stat()
	if err != nil {
		t.Errorf("%s", err)
	}
	if !fileInfo.IsDir() {
		t.Errorf("%s is not a directory", path)
	}
	if perm := fileInfo.Mode().Perm(); perm != 0755 {
		t.Errorf("%s has wrong permissions: %s (expected %s)", path, perm, 0755)
	}
}

func TestMain(m *testing.M) {
	setup()
	code := m.Run()
	shutdown()
	os.Exit(code)
}

func shutdown() {
	defer os.RemoveAll(config.ReposPath)
}

{'fraction_non_alphanumeric': 0.1882591093117409, 'fraction_numerical': 0.008097165991902834, 'mean_word_length': 3.7183770883054894, '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': '200220', 'n_tokens_mistral': 828, 'n_tokens_neox': 795, 'n_words': 197}