Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gitbug] Correctly expand user home directory path #1033

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions bugwarrior/services/gitbug.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
import os
import pathlib
import signal
import subprocess
import sys
Expand All @@ -17,7 +16,7 @@
class GitBugConfig(config.ServiceConfig):
service: typing_extensions.Literal['gitbug']

path: pathlib.Path
path: config.ExpandedPath

import_labels_as_tags: bool = False
label_template: str = '{{label}}'
Expand Down
14 changes: 12 additions & 2 deletions tests/test_gitbug.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import dateutil
import pydantic

from bugwarrior.services.gitbug import GitBugClient, GitBugService
from bugwarrior.services.gitbug import GitBugClient, GitBugConfig, GitBugService

from .base import AbstractServiceTest, ServiceTest
from .base import AbstractServiceTest, ConfigTest, ServiceTest


# NOTE: replace with stdlib dataclasses.dataclass once python-3.6 is dropped
Expand Down Expand Up @@ -83,3 +83,13 @@ def test_issues(self):
}

self.assertEqual(issue.get_taskwarrior_record(), expected)


class TestGitBugConfig(ConfigTest):
def setUp(self):
super().setUp()
self.config = GitBugConfig(service="gitbug", path="~/custom-gitbug-repo")

def test_home_path_expansion(self):
expected = self.tempdir + "/custom-gitbug-repo"
self.assertEqual(self.config.path, expected)
Loading