mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-19 04:28:31 +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
|
python-version: 3.9
|
||||||
|
|
||||||
steps:
|
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
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
@ -56,7 +51,7 @@ jobs:
|
||||||
poetry config --local virtualenvs.in-project true
|
poetry config --local virtualenvs.in-project true
|
||||||
poetry install --remove-untracked
|
poetry install --remove-untracked
|
||||||
poetry install
|
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
|
- name: Test with pytest
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
import ast
|
import ast
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from jrnl.args import parse_args
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import re
|
import re
|
||||||
|
@ -14,20 +13,20 @@ from behave import given
|
||||||
from behave import then
|
from behave import then
|
||||||
from behave import when
|
from behave import when
|
||||||
import keyring
|
import keyring
|
||||||
|
|
||||||
import toml
|
import toml
|
||||||
import yaml
|
import yaml
|
||||||
from yaml.loader import FullLoader
|
from yaml.loader import FullLoader
|
||||||
|
|
||||||
|
|
||||||
import jrnl.time
|
|
||||||
from jrnl import Journal
|
from jrnl import Journal
|
||||||
from jrnl import __version__
|
from jrnl import __version__
|
||||||
from jrnl import plugins
|
from jrnl import plugins
|
||||||
|
from jrnl.args import parse_args
|
||||||
from jrnl.cli import cli
|
from jrnl.cli import cli
|
||||||
from jrnl.config import load_config
|
from jrnl.config import load_config
|
||||||
from jrnl.os_compat import split_args
|
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:
|
try:
|
||||||
import parsedatetime.parsedatetime_consts as pdt
|
import parsedatetime.parsedatetime_consts as pdt
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from jrnl.plugins.base import BaseExporter
|
from jrnl.plugins.base import BaseExporter
|
||||||
from jrnl.plugins.util import get_tags_count
|
|
||||||
|
|
||||||
__version__ = "v1.0.0"
|
__version__ = "v1.0.0"
|
||||||
|
|
||||||
|
@ -32,7 +31,6 @@ class Exporter(BaseExporter):
|
||||||
@classmethod
|
@classmethod
|
||||||
def export_journal(cls, journal):
|
def export_journal(cls, journal):
|
||||||
"""Returns a json representation of an entire journal."""
|
"""Returns a json representation of an entire journal."""
|
||||||
tags = get_tags_count(journal)
|
|
||||||
result = {
|
result = {
|
||||||
"entries": [cls.entry_to_dict(e) for e in journal.entries],
|
"entries": [cls.entry_to_dict(e) for e in journal.entries],
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,17 @@ import pytest
|
||||||
from jrnl import Entry
|
from jrnl import Entry
|
||||||
from jrnl import Journal
|
from jrnl import Journal
|
||||||
from jrnl.plugins.exporter import json as json_exporter
|
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()
|
if testing_exporter:
|
||||||
def create_entry():
|
|
||||||
|
@pytest.fixture()
|
||||||
|
def create_entry():
|
||||||
entry = Entry.Entry(
|
entry = Entry.Entry(
|
||||||
journal=Journal.Journal(),
|
journal=Journal.Journal(),
|
||||||
text="This is the entry text",
|
text="This is the entry text",
|
||||||
|
@ -19,15 +25,13 @@ def create_entry():
|
||||||
)
|
)
|
||||||
yield entry
|
yield entry
|
||||||
|
|
||||||
|
class TestBaseExporter(testing_exporter.Exporter):
|
||||||
class TestBaseExporter(testing_exporter.Exporter):
|
|
||||||
def test_unimplemented_export(self, create_entry):
|
def test_unimplemented_export(self, create_entry):
|
||||||
entry = create_entry
|
entry = create_entry
|
||||||
with pytest.raises(NotImplementedError):
|
with pytest.raises(NotImplementedError):
|
||||||
self.export_entry(entry)
|
self.export_entry(entry)
|
||||||
|
|
||||||
|
class TestJsonExporter(json_exporter.Exporter):
|
||||||
class TestJsonExporter(json_exporter.Exporter):
|
|
||||||
def test_json_exporter_name(self):
|
def test_json_exporter_name(self):
|
||||||
assert "json" in self.names
|
assert "json" in self.names
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue