mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 06:20:08 +01:00
tests for error cases
This commit is contained in:
parent
863bc956c7
commit
b816800534
3 changed files with 37 additions and 1 deletions
3
test/fixtures/project_b/README.rst
vendored
3
test/fixtures/project_b/README.rst
vendored
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
.. |badge| image:: https://img.shields.io/badge/PyCalVer-v201307.0456--beta-blue.svg
|
||||||
|
:target: https://shields.io/
|
||||||
2
test/fixtures/project_b/setup.cfg
vendored
2
test/fixtures/project_b/setup.cfg
vendored
|
|
@ -10,6 +10,6 @@ setup.cfg =
|
||||||
setup.py =
|
setup.py =
|
||||||
version="{pep440_version}"
|
version="{pep440_version}"
|
||||||
README.rst =
|
README.rst =
|
||||||
img.shields.io/badge/PyCalVer-{calver}{build}--{release}-blue
|
img.shields.io/badge/PyCalVer-{calver}{build}-{release}-blue
|
||||||
src/module_v*/__init__.py =
|
src/module_v*/__init__.py =
|
||||||
__version__ = "{version}"
|
__version__ = "{version}"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import copy
|
||||||
|
|
||||||
from pycalver import config
|
from pycalver import config
|
||||||
from pycalver import rewrite
|
from pycalver import rewrite
|
||||||
|
|
||||||
|
|
@ -67,3 +69,34 @@ def test_iter_file_globs():
|
||||||
"src/module_v1/__init__.py",
|
"src/module_v1/__init__.py",
|
||||||
"src/module_v2/__init__.py",
|
"src/module_v2/__init__.py",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_error_bad_path():
|
||||||
|
with util.Project(project="b") as project:
|
||||||
|
ctx = config.init_project_ctx(project.dir)
|
||||||
|
cfg = config.parse(ctx)
|
||||||
|
assert cfg
|
||||||
|
|
||||||
|
(project.dir / "setup.py").unlink()
|
||||||
|
try:
|
||||||
|
list(rewrite._iter_file_paths(cfg.file_patterns))
|
||||||
|
assert False, "expected ValueError"
|
||||||
|
except ValueError as ex:
|
||||||
|
assert "setup.py" in str(ex)
|
||||||
|
|
||||||
|
|
||||||
|
def test_error_bad_pattern():
|
||||||
|
with util.Project(project="b") as project:
|
||||||
|
ctx = config.init_project_ctx(project.dir)
|
||||||
|
cfg = config.parse(ctx)
|
||||||
|
assert cfg
|
||||||
|
|
||||||
|
patterns = copy.deepcopy(cfg.file_patterns)
|
||||||
|
print(patterns)
|
||||||
|
patterns["setup.py"] = patterns["setup.py"][0] + "invalid"
|
||||||
|
|
||||||
|
try:
|
||||||
|
list(rewrite.diff("v201809.1234", patterns))
|
||||||
|
assert False, "expected ValueError"
|
||||||
|
except ValueError as ex:
|
||||||
|
assert "setup.py" in str(ex)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue