Skip to content

Commit

Permalink
Merge branch '1.2' into 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed Jun 26, 2018
2 parents 1a47d84 + 1c57e63 commit 8acc0fb
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 26 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Changelog
=========

- :bug:`-` ``checks.blacken`` had a typo regarding its folder selection
argument; the CLI/function arg was ``folder`` while the configuration value
was ``folders`` (plural). It's been made consistent: the CLI/function
argument is now ``folders``.
- :release:`1.3.0 <2018-06-20>`
- :feature:`-` Bump Releases requirement up to 1.6 and leverage its new ability
to load Sphinx extensions, in ``packaging.release.prepare`` (which parses
Expand Down
12 changes: 6 additions & 6 deletions invocations/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from invoke import task


@task(name="blacken", iterable=["folder"])
def blacken(c, line_length=79, folder=None, check=False, diff=False):
@task(name="blacken", iterable=["folders"])
def blacken(c, line_length=79, folders=None, check=False, diff=False):
"""
Run black on the current source tree (all ``.py`` files).
Expand All @@ -20,9 +20,9 @@ def blacken(c, line_length=79, folder=None, check=False, diff=False):
:param int line_length:
Line length argument. Default: ``79``.
:param str folder:
Folder(s) to search within for ``.py`` files. May be given multiple
times to search N folders. Default: ``["."]``. Honors the
:param list folders:
List of folders (or, on the CLI, an argument that can be given N times)
to search within for ``.py`` files. Default: ``["."]``. Honors the
``blacken.folders`` config option.
:param bool check:
Whether to run ``black --check``. Default: ``False``.
Expand All @@ -35,7 +35,7 @@ def blacken(c, line_length=79, folder=None, check=False, diff=False):
configured_folders = c.config.get("blacken", {}).get(
"folders", default_folders
)
folders = configured_folders if not folder else folder
folders = folders or configured_folders

black_command_line = "black -l {}".format(line_length)
if check:
Expand Down
1 change: 0 additions & 1 deletion invocations/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def make_handler(ctx, task_, regexes, ignore_regexes, *args, **kwargs):
sys.exit("If you want to use this, 'pip install watchdog' first.")

class Handler(RegexMatchingEventHandler):

def on_any_event(self, event):
try:
task_(*args, **kwargs)
Expand Down
1 change: 0 additions & 1 deletion tests/autodoc/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def _build():


class autodoc_:

@classmethod
def setup_class(self):
# Build once, introspect many...for now
Expand Down
18 changes: 13 additions & 5 deletions tests/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ class blacken_:
"find . -name '*.py' | xargs black -l 80",
),
(
dict(folder=["foo", "bar"]),
dict(folders=["foo", "bar"]),
"find foo bar -name '*.py' | xargs black -l 79",
),
(
# Explicit invocation that matches a default CLI
# invocation, since 'folders' is an iterable and thus shows
# up as an empty list in real life. Ehhh.
dict(folders=[]),
"find . -name '*.py' | xargs black -l 79",
),
(
dict(check=True),
"find . -name '*.py' | xargs black -l 79 --check",
Expand All @@ -30,7 +37,7 @@ class blacken_:
diff=True,
check=True,
line_length=80,
folder=["foo", "bar"],
folders=["foo", "bar"],
),
"find foo bar -name '*.py' | xargs black -l 80 --check --diff", # noqa
),
Expand All @@ -39,6 +46,7 @@ class blacken_:
"base case is all files and 79 characters",
"line length controllable",
"folders controllable",
"folders real default value",
"check flag passed through",
"diff flag passed through",
"most args combined",
Expand All @@ -48,14 +56,14 @@ def runs_black(self, ctx, kwargs, command):
blacken(ctx, **kwargs)
ctx.run.assert_called_once_with(command, pty=True)

def folder_configurable(self, ctx):
def folders_configurable(self, ctx):
# Just config -> works fine
ctx.blacken = dict(folders=["elsewhere"])
blacken(ctx)
assert "elsewhere" in ctx.run.call_args[0][0]

def folder_config_loses_to_runtime(self, ctx):
def folders_config_loses_to_runtime(self, ctx):
# Config + CLI opt -> CLI opt wins
ctx.blacken = dict(folders=["nowhere"])
blacken(ctx, folder=["nowhere"])
blacken(ctx, folders=["nowhere"])
assert "nowhere" in ctx.run.call_args[0][0]
1 change: 0 additions & 1 deletion tests/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class confirm_:

@patch("invocations.console.input", return_value="yes")
def displays_question_with_yes_no_suffix(self, mock_input):
confirm("Are you sure?")
Expand Down
12 changes: 0 additions & 12 deletions tests/packaging/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


class _release_line_:

def assumes_bugfix_if_release_branch(self):
c = MockContext(run=Result("2.7"))
assert _release_line(c)[1] == Release.BUGFIX
Expand All @@ -51,7 +50,6 @@ def is_undefined_if_specific_commit_checkout(self):


class _latest_feature_bucket_:

def base_case_of_single_release_family(self):
bucket = _latest_feature_bucket(
dict.fromkeys(["unreleased_1_feature"])
Expand Down Expand Up @@ -83,7 +81,6 @@ def ordering_goes_by_numeric_not_lexical_order(self):


class _release_and_issues_:

class bugfix:
# TODO: factor out into setup() so each test has some excluded/ignored
# data in it - helps avoid naive implementation returning x[0] etc.
Expand All @@ -101,7 +98,6 @@ def has_unreleased(self):
skip()

class feature:

def no_unreleased(self):
# release is None, issues is empty list
release, issues = _release_and_issues(
Expand All @@ -127,7 +123,6 @@ def undefined_always_returns_None_and_empty_list(self):


class _find_package_:

def can_be_short_circuited_with_config_value(self):
# TODO: should we just bundle this + the version part into one
# function and setting? do we ever peep into the package for anything
Expand All @@ -149,7 +144,6 @@ def errors_if_ambiguous_results(self):


class load_version_:

def setup(self):
sys.path.insert(0, support_dir)

Expand Down Expand Up @@ -178,7 +172,6 @@ def errors_usefully_if_version_module_not_found(self):


class _latest_and_next_version_:

def next_patch_of_bugfix_release(self):
versions = _latest_and_next_version(
Lexicon(
Expand Down Expand Up @@ -330,7 +323,6 @@ def _expect_actions(self, *actions):


class status_:

class overall_behavior:
_branch = "1.1"
_changelog = "unreleased_1.1_bugs"
Expand Down Expand Up @@ -732,9 +724,7 @@ def no_changelog_update_needed_means_no_changelog_edit(self, _):
# TERM=screen-256color, that made these tests break! Updating test machinery to
# account for now, but...not ideal!
class component_state_enums_contain_human_readable_values:

class changelog:

def okay(self):
expected = "\x1b[32m\u2714 no unreleased issues\x1b(B\x1b[m"
assert Changelog.OKAY.value == expected
Expand All @@ -744,7 +734,6 @@ def needs_release(self):
assert Changelog.NEEDS_RELEASE.value == expected

class version_file:

def okay(self):
expected = "\x1b[32m\u2714 version up to date\x1b(B\x1b[m"
assert VersionFile.OKAY.value == expected
Expand All @@ -754,7 +743,6 @@ def needs_bump(self):
assert VersionFile.NEEDS_BUMP.value == expected

class tag:

def okay(self):
assert Tag.OKAY.value == "\x1b[32m\u2714 all set\x1b(B\x1b[m"

Expand Down

0 comments on commit 8acc0fb

Please sign in to comment.