Skip to content

Commit

Permalink
Fixing pip issue while installing
Browse files Browse the repository at this point in the history
  • Loading branch information
miromannino committed Feb 24, 2025
1 parent cce9ece commit 3b884d4
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 29 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Include the README.md needed as README to describe the mock repo content
recursive-include src/git_import_contributions README.md
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
pythonpath = src
1 change: 0 additions & 1 deletion scripts/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export PYTHONPATH=".:$PYTHONPATH"
pipenv run pytest
2 changes: 1 addition & 1 deletion src/git_import_contributions/Committer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import git

from .commons import Author
from git_import_contributions.commons import Author


class Committer:
Expand Down
21 changes: 12 additions & 9 deletions src/git_import_contributions/ImporterFromRepository.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/python3

import pathlib
import random
import time
from random import random

from .Committer import Committer
from .commons import extract_name_email
from .Content import Content
from .generators import apply_generator
from .Stats import Stats
from git_import_contributions.Committer import Committer
from git_import_contributions.commons import extract_name_email
from git_import_contributions.Content import Content
from git_import_contributions.generators import apply_generator
from git_import_contributions.Stats import Stats


class ImporterFromRepository:
Expand Down Expand Up @@ -104,7 +104,7 @@ def import_repository(self):

committed_date = c.committed_date
if self.commit_time_max_past > 0:
committed_date -= int(random() * self.commit_time_max_past)
committed_date -= int(random.random() * self.commit_time_max_past)
print(
" Commit date changed to: "
+ time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(c.committed_date))
Expand All @@ -127,14 +127,17 @@ def import_repository(self):
max_past = self.changes_commits_max_time_backward
if last_committed_date != 0:
max_past = min(break_committed_date - last_committed_date, max_past)
break_committed_date -= int(random() * (max_past / 3) + (max_past / 3 * 2))
break_committed_date -= int(
random.random() * (max_past / 3) + (max_past / 3 * 2)
)
if time.strftime("%Y-%m-%d", time.localtime(last_committed_date)) == time.strftime(
"%Y-%m-%d", time.localtime(break_committed_date)
):
commits_for_last_day += 1
if (
commits_for_last_day
> random() * (self.max_commits_per_day[1] - self.max_commits_per_day[0])
> random.random()
* (self.max_commits_per_day[1] - self.max_commits_per_day[0])
+ self.max_commits_per_day[0]
):
print(
Expand Down
10 changes: 5 additions & 5 deletions src/git_import_contributions/ImporterFromStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

import git

from .Committer import Committer
from .commons import extract_name_email
from .Content import Content
from .generators import apply_generator
from .Stats import Stats
from git_import_contributions.Committer import Committer
from git_import_contributions.commons import extract_name_email
from git_import_contributions.Content import Content
from git_import_contributions.generators import apply_generator
from git_import_contributions.Stats import Stats

DEFAULT_TIME_RANGE = (9, 18)
DEFAULT_MAX_COMMITS_PER_DAY = 10
Expand Down
4 changes: 2 additions & 2 deletions src/git_import_contributions/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import git

from .ImporterFromRepository import ImporterFromRepository
from .ImporterFromStats import ImporterFromStats
from git_import_contributions.ImporterFromRepository import ImporterFromRepository
from git_import_contributions.ImporterFromStats import ImporterFromStats


def handle_stats_action(args):
Expand Down
2 changes: 1 addition & 1 deletion tests/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import git

from src import *
from git_import_contributions.ImporterFromRepository import ImporterFromRepository

repos_path = [
"/path/to/Project1",
Expand Down
7 changes: 3 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
import subprocess

import git
import pytest

from .tests_commons import MOCK_REPO_PATH, REPOS_PATHS


def test_cli_collapse_changes():
cli_command_collapsed = [
"python",
"src/cli.py",
"src/git_import_contributions/cli.py",
"repo",
"--repos",
*REPOS_PATHS,
Expand All @@ -24,7 +23,7 @@ def test_cli_collapse_changes():

cli_command_non_collapsed = [
"python",
"src/cli.py",
"src/git_import_contributions/cli.py",
"repo",
"--repos",
*REPOS_PATHS,
Expand Down Expand Up @@ -66,7 +65,7 @@ def test_cli_collapse_changes():
def test_cli_filter_by_author():
cli_command = [
"python",
"src/cli.py",
"src/git_import_contributions/cli.py",
"repo",
"--repos",
*REPOS_PATHS,
Expand Down
3 changes: 1 addition & 2 deletions tests/test_cli_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import subprocess

import git
import pytest

from .tests_commons import MOCK_REPO_PATH

Expand All @@ -13,7 +12,7 @@
def test_cli_stats():
cli_command = [
"python",
"src/cli.py",
"src/git_import_contributions/cli.py",
"stats",
"--csv",
"tests/stats_1.csv",
Expand Down
3 changes: 2 additions & 1 deletion tests/test_collapse_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import git
import pytest

from .ImporterFromRepository import ImporterFromRepository
from git_import_contributions.ImporterFromRepository import ImporterFromRepository

from .tests_commons import MOCK_REPO_PATH, REPOS_PATHS


Expand Down
2 changes: 1 addition & 1 deletion tests/test_ignore_file_types.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import shutil

import git
import pytest

from git_import_contributions.ImporterFromRepository import ImporterFromRepository
from src import *

from .tests_commons import MOCK_REPO_PATH, REPOS_PATHS
Expand Down
3 changes: 2 additions & 1 deletion tests/test_max_changes_per_file.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
import shutil

import git
import pytest

from git_import_contributions.ImporterFromRepository import ImporterFromRepository
from src import *

from .tests_commons import MOCK_REPO_PATH, REPOS_PATHS, import_commits
Expand Down
2 changes: 1 addition & 1 deletion tests/test_obfuscation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import sys

import git
import pytest

from git_import_contributions.ImporterFromRepository import ImporterFromRepository
from src import *

from .tests_commons import MOCK_REPO_PATH, REPOS_PATHS, import_commits
Expand Down

0 comments on commit 3b884d4

Please sign in to comment.