Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
akazukin5151 committed May 27, 2020
2 parents af4416a + 34d89de commit aff7cfe
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 23 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ You can also use versions less than v0.5.1, which retains legacy support for the
* Edit the files on your fork/branch
* If your git client complains about committing to master, just remove `.pre-commit-config.yaml`
* Run tests with `pytest testing/ -vvvv -l -s --icat`
* Try it with `python koneko/main.py`, or `python setup.py install` then `koneko` to simulate a pip install (or `pip install .`; check out [manual installation](#manual-installation))
* Try it with `python setup.py install` then `koneko` to simulate a pip install (or `pip install .`; check out [manual installation](#manual-installation))
* If doing the latter, make sure you aren't running the released version on pypi (totally didn't happen to me).
* Submit a pull request
* If you want to, you can create an issue first. Ask any questions by opening a new issue.
Expand Down Expand Up @@ -236,6 +236,8 @@ Run `pytest testing/ -vvvv -l -s --icat`. If icat fails, skip the three offendin
## Upload to PyPI
When test installing with pip, don't forget to use `pip install .` or `python setup.py install`, not `pip install koneko` (which will grab from latest stable version). (Yes, I made the same mistake again)

**Warning:** you *must* test installing with both `pip install .` and `python setup.py install`.

Bump version info in `__init__.py`, `setup.py`, and `README.md`

```sh
Expand Down
2 changes: 1 addition & 1 deletion koneko/koneko/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import funcy
from pixivpy3 import PixivError, AppPixivAPI

from koneko import pure
from koneko.koneko import pure


class APIHandler:
Expand Down
2 changes: 1 addition & 1 deletion koneko/koneko/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

from docopt import docopt

from koneko import pure
from koneko.koneko import pure


def process_cli_args():
Expand Down
2 changes: 1 addition & 1 deletion koneko/koneko/data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Stores json data from the api. Acts as frontend to access data in a single line.
Functionally pure, no side effects (but stores state)
"""
from koneko import KONEKODIR, pure
from koneko.koneko import KONEKODIR, pure


class GalleryJson:
Expand Down
2 changes: 1 addition & 1 deletion koneko/koneko/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import cytoolz

from koneko import api, pure, utils
from koneko.koneko import api, pure, utils


@pure.spinner('')
Expand Down
4 changes: 2 additions & 2 deletions koneko/koneko/lscat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from pixcat import Image
from blessed import Terminal

from koneko.pure import cd
from koneko import utils
from koneko.koneko.pure import cd
from koneko.koneko import utils

TERM = Terminal()

Expand Down
2 changes: 1 addition & 1 deletion koneko/koneko/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from blessed import Terminal

from koneko import ui, pure, colors
from koneko.koneko import ui, pure, colors

TERM = Terminal()

Expand Down
2 changes: 1 addition & 1 deletion koneko/koneko/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from tqdm import tqdm

from koneko import (KONEKODIR, api, data, pure, lscat, utils, colors, prompt,
from koneko.koneko import (KONEKODIR, api, data, pure, lscat, utils, colors, prompt,
download)


Expand Down
2 changes: 1 addition & 1 deletion koneko/koneko/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import pixcat

from koneko import KONEKODIR, ui, cli, pure, __version__
from koneko.koneko import KONEKODIR, ui, cli, pure, __version__


def verify_full_download(filepath):
Expand Down
2 changes: 1 addition & 1 deletion testing/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
sys.path.append('../koneko/koneko')
sys.path.append('testing')

from koneko import pure, lscat, utils, data, KONEKODIR
from koneko.koneko import pure, lscat, utils, data, KONEKODIR
from page_json import * # Imports the current_page (dict) stored in disk

page_illusts = page_json["illusts"]
Expand Down
4 changes: 2 additions & 2 deletions testing/test_lscat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sys.path.append('../koneko/koneko')
sys.path.append('testing')

from koneko import lscat
from koneko.koneko import lscat

def test_xcoords():
assert lscat.xcoords(100) == [2, 20, 38, 56, 74]
Expand All @@ -34,7 +34,7 @@ def __init__(self):
self.download_path = Path('testing/files/')

# This config has noprint = False
monkeypatch.setattr('koneko.utils.Path.expanduser',
monkeypatch.setattr('koneko.koneko.utils.Path.expanduser',
lambda x: Path('example_config.ini'))

fakedata = FakeData()
Expand Down
2 changes: 1 addition & 1 deletion testing/test_pure.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sys.path.append('../koneko/koneko')
sys.path.append('testing')

from koneko import pure, lscat, utils, data, KONEKODIR
from koneko.koneko import pure, lscat, utils, data, KONEKODIR
from page_json import * # Imports the current_page (dict) stored in disk

page_illusts = page_json["illusts"]
Expand Down
18 changes: 9 additions & 9 deletions testing/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
sys.path.append('../koneko/koneko')
sys.path.append('testing')

from koneko import utils
from koneko.koneko import utils

@pytest.fixture
def turn_off_print(monkeypatch):
Expand Down Expand Up @@ -58,15 +58,15 @@ def test_info_screen_loop(monkeypatch):
os.system("kitty +kitten icat --clear")

def test_check_noprint(monkeypatch):
monkeypatch.setattr("koneko.utils.get_settings", lambda x, y: "on")
monkeypatch.setattr("koneko.koneko.utils.get_settings", lambda x, y: "on")
assert utils.check_noprint() == True
monkeypatch.setattr("koneko.utils.get_settings", lambda x, y: "off")
monkeypatch.setattr("koneko.koneko.utils.get_settings", lambda x, y: "off")
assert utils.check_noprint() == False
monkeypatch.setattr("koneko.utils.get_settings", lambda x, y: "false")
monkeypatch.setattr("koneko.koneko.utils.get_settings", lambda x, y: "false")
assert utils.check_noprint() == False

# Test with an actual cfg
monkeypatch.setattr('koneko.utils.Path.expanduser',
monkeypatch.setattr('koneko.koneko.utils.Path.expanduser',
lambda x: Path('example_config.ini'))
assert utils.check_noprint() == False

Expand All @@ -77,7 +77,7 @@ def test_noprint(capsys):

def test_get_settings(monkeypatch):
# Redivert the config path
monkeypatch.setattr('koneko.utils.Path.expanduser',
monkeypatch.setattr('koneko.koneko.utils.Path.expanduser',
lambda x: Path('example_config.ini'))

assert utils.get_settings('Credentials', 'username') == 'koneko'
Expand All @@ -89,7 +89,7 @@ def test_get_settings(monkeypatch):
def test_config(monkeypatch):
# If config exists
example_path = Path('example_config.ini')
monkeypatch.setattr('koneko.utils.Path.expanduser', lambda x: example_path)
monkeypatch.setattr('koneko.koneko.utils.Path.expanduser', lambda x: example_path)

creds, your_id = utils.config()
assert your_id == '1234'
Expand All @@ -101,12 +101,12 @@ def test_config(monkeypatch):
if test_cfg_path.exists():
os.system(f'rm {test_cfg_path}')

monkeypatch.setattr('koneko.utils.Path.expanduser', lambda x: test_cfg_path)
monkeypatch.setattr('koneko.koneko.utils.Path.expanduser', lambda x: test_cfg_path)

# It asks for multiple inputs: username, whether to save user id, user id
responses = iter(['myusername', 'y', 'myid'])
monkeypatch.setattr('builtins.input', lambda x=None: next(responses))
monkeypatch.setattr('koneko.utils.getpass', lambda: 'mypassword')
monkeypatch.setattr('koneko.koneko.utils.getpass', lambda: 'mypassword')

creds, your_id = utils.config()
assert your_id == 'myid'
Expand Down

0 comments on commit aff7cfe

Please sign in to comment.