mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-18 20:18:32 +02:00
style fixes for GitHub actions
This commit is contained in:
parent
c8ca3a0358
commit
e1d2f873da
4 changed files with 38 additions and 42 deletions
|
@ -32,11 +32,6 @@ jobs:
|
|||
python-version: 3.9
|
||||
|
||||
steps:
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
|
||||
id: extract_branch
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -56,7 +51,7 @@ jobs:
|
|||
poetry config --local virtualenvs.in-project true
|
||||
poetry install --remove-untracked
|
||||
poetry install
|
||||
poetry run python -m pip install -e "git+${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git@{{ steps.extract_branch.outputs.branch }}#egg=jrnl-demo-plugins&subdirectory=tests/external_plugins_src"
|
||||
poetry run python -m pip install -e "git+${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git@${GITHUB_SHA}#egg=jrnl-demo-plugins&subdirectory=tests/external_plugins_src"
|
||||
|
||||
- name: Test with pytest
|
||||
if: success() || failure()
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
import ast
|
||||
from collections import defaultdict
|
||||
from jrnl.args import parse_args
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
@ -14,20 +13,20 @@ from behave import given
|
|||
from behave import then
|
||||
from behave import when
|
||||
import keyring
|
||||
|
||||
import toml
|
||||
import yaml
|
||||
from yaml.loader import FullLoader
|
||||
|
||||
|
||||
import jrnl.time
|
||||
from jrnl import Journal
|
||||
from jrnl import __version__
|
||||
from jrnl import plugins
|
||||
from jrnl.args import parse_args
|
||||
from jrnl.cli import cli
|
||||
from jrnl.config import load_config
|
||||
from jrnl.os_compat import split_args
|
||||
from jrnl.override import apply_overrides, _recursively_apply
|
||||
from jrnl.override import _recursively_apply
|
||||
from jrnl.override import apply_overrides
|
||||
import jrnl.time
|
||||
|
||||
try:
|
||||
import parsedatetime.parsedatetime_consts as pdt
|
||||
|
@ -461,7 +460,7 @@ def run(context, command, text=""):
|
|||
@given('we load template "{filename}"')
|
||||
def load_template(context, filename):
|
||||
full_path = os.path.join("features/data/templates", filename)
|
||||
|
||||
|
||||
exporter = plugins.template_exporter.__exporter_from_file(full_path)
|
||||
plugins.meta.__exporter_types[exporter.names[0]] = exporter
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import json
|
||||
|
||||
from jrnl.plugins.base import BaseExporter
|
||||
from jrnl.plugins.util import get_tags_count
|
||||
|
||||
__version__ = "v1.0.0"
|
||||
|
||||
|
@ -32,7 +31,6 @@ class Exporter(BaseExporter):
|
|||
@classmethod
|
||||
def export_journal(cls, journal):
|
||||
"""Returns a json representation of an entire journal."""
|
||||
tags = get_tags_count(journal)
|
||||
result = {
|
||||
"entries": [cls.entry_to_dict(e) for e in journal.entries],
|
||||
}
|
||||
|
|
|
@ -6,37 +6,41 @@ import pytest
|
|||
from jrnl import Entry
|
||||
from jrnl import Journal
|
||||
from jrnl.plugins.exporter import json as json_exporter
|
||||
from jrnl.plugins.exporter import testing as testing_exporter
|
||||
|
||||
try:
|
||||
from jrnl.contrib.exporter import testing as testing_exporter
|
||||
except:
|
||||
testing_exporter = None
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def create_entry():
|
||||
entry = Entry.Entry(
|
||||
journal=Journal.Journal(),
|
||||
text="This is the entry text",
|
||||
date=date(year=2001, month=1, day=1),
|
||||
starred=True,
|
||||
)
|
||||
yield entry
|
||||
if testing_exporter:
|
||||
|
||||
@pytest.fixture()
|
||||
def create_entry():
|
||||
entry = Entry.Entry(
|
||||
journal=Journal.Journal(),
|
||||
text="This is the entry text",
|
||||
date=date(year=2001, month=1, day=1),
|
||||
starred=True,
|
||||
)
|
||||
yield entry
|
||||
|
||||
class TestBaseExporter(testing_exporter.Exporter):
|
||||
def test_unimplemented_export(self, create_entry):
|
||||
entry = create_entry
|
||||
with pytest.raises(NotImplementedError):
|
||||
self.export_entry(entry)
|
||||
class TestBaseExporter(testing_exporter.Exporter):
|
||||
def test_unimplemented_export(self, create_entry):
|
||||
entry = create_entry
|
||||
with pytest.raises(NotImplementedError):
|
||||
self.export_entry(entry)
|
||||
|
||||
class TestJsonExporter(json_exporter.Exporter):
|
||||
def test_json_exporter_name(self):
|
||||
assert "json" in self.names
|
||||
|
||||
class TestJsonExporter(json_exporter.Exporter):
|
||||
def test_json_exporter_name(self):
|
||||
assert "json" in self.names
|
||||
|
||||
def test_export_entry(self, create_entry):
|
||||
entry = create_entry
|
||||
fake_uuid = "ewqf09-432p9p0433-243209" # generated by mashing keys
|
||||
entry.uuid = fake_uuid
|
||||
exported = self.export_entry(entry)
|
||||
deserialized_export = json.loads(exported)
|
||||
assert deserialized_export["title"] == "This is the entry text"
|
||||
assert deserialized_export["date"] == "2001-01-01"
|
||||
assert "uuid" in deserialized_export.keys()
|
||||
def test_export_entry(self, create_entry):
|
||||
entry = create_entry
|
||||
fake_uuid = "ewqf09-432p9p0433-243209" # generated by mashing keys
|
||||
entry.uuid = fake_uuid
|
||||
exported = self.export_entry(entry)
|
||||
deserialized_export = json.loads(exported)
|
||||
assert deserialized_export["title"] == "This is the entry text"
|
||||
assert deserialized_export["date"] == "2001-01-01"
|
||||
assert "uuid" in deserialized_export.keys()
|
||||
|
|
Loading…
Add table
Reference in a new issue