Skip to content

Commit 03bc298

Browse files
committed
Update "tasks.py" file.
1 parent adb2717 commit 03bc298

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

tasks.py

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,17 @@ def sub_callable(match):
377377

378378
source = re.sub(
379379
"from setuptools import setup",
380-
"import codecs\nfrom setuptools import setup",
380+
(
381+
'"""\n'
382+
"Colour - Checker Detection - Setup\n"
383+
"==================================\n"
384+
'"""\n\n'
385+
"import codecs\n"
386+
"from setuptools import setup"
387+
),
381388
source,
382389
)
390+
source = re.sub('{.*extra == "read-the-docs".*', "{", source)
383391
source = re.sub(
384392
"setup_kwargs = {(.*)}.*setup\\(\\*\\*setup_kwargs\\)",
385393
sub_callable,
@@ -401,6 +409,8 @@ def sub_callable(match):
401409
with open("setup.py", "w") as setup_file:
402410
setup_file.write(source)
403411

412+
ctx.run("poetry run pre-commit run --files setup.py || true")
413+
404414
ctx.run("twine check dist/*")
405415

406416

@@ -421,15 +431,21 @@ def virtualise(ctx: Context, tests: Boolean = True):
421431
ctx.run(f"tar -xvf {PYPI_PACKAGE_NAME}-{APPLICATION_VERSION}.tar.gz")
422432
ctx.run(f"mv {PYPI_PACKAGE_NAME}-{APPLICATION_VERSION} {unique_name}")
423433
with ctx.cd(unique_name):
424-
ctx.run("poetry env use 3")
425-
ctx.run("poetry install")
434+
ctx.run('poetry install --extras "plotting"')
426435
ctx.run("source $(poetry env info -p)/bin/activate")
427436
ctx.run(
428437
'python -c "import imageio;'
429438
'imageio.plugins.freeimage.download()"'
430439
)
431440
if tests:
432-
ctx.run("poetry run nosetests")
441+
ctx.run(
442+
"poetry run py.test "
443+
"--disable-warnings "
444+
"--doctest-modules "
445+
f"--ignore={PYTHON_PACKAGE_NAME}/examples "
446+
f"{PYTHON_PACKAGE_NAME}",
447+
env={"MPLBACKEND": "AGG"},
448+
)
433449

434450

435451
@task
@@ -452,14 +468,20 @@ def tag(ctx: Context):
452468
with open(os.path.join(PYTHON_PACKAGE_NAME, "__init__.py")) as file_handle:
453469
file_content = file_handle.read()
454470
major_version = re.search(
455-
"__major_version__\\s+=\\s+'(.*)'", file_content
456-
).group(1)
471+
'__major_version__\\s+=\\s+"(.*)"', file_content
472+
).group( # type: ignore[union-attr]
473+
1
474+
)
457475
minor_version = re.search(
458-
"__minor_version__\\s+=\\s+'(.*)'", file_content
459-
).group(1)
476+
'__minor_version__\\s+=\\s+"(.*)"', file_content
477+
).group( # type: ignore[union-attr]
478+
1
479+
)
460480
change_version = re.search(
461-
"__change_version__\\s+=\\s+'(.*)'", file_content
462-
).group(1)
481+
'__change_version__\\s+=\\s+"(.*)"', file_content
482+
).group( # type: ignore[union-attr]
483+
1
484+
)
463485

464486
version = ".".join((major_version, minor_version, change_version))
465487

0 commit comments

Comments
 (0)