Skip to content

Commit

Permalink
Add meaningful tests to new-layout
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianhauser committed Apr 29, 2020
1 parent 5466b97 commit cfe6865
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/docs/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ python = "*"

[tool.poetry.dev-dependencies]
pytest = "^3.4"
toml = "^0.10.0"
```

### Specifying dependencies
Expand Down
4 changes: 3 additions & 1 deletion poetry/console/commands/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def handle(self):
".".join(str(v) for v in current_env.version_info[:2])
)

dev_dependencies = {}
dev_dependencies = {
"toml": "^0.10.0",
}
python_constraint = parse_constraint(default_python)
if parse_constraint("<3.5").allows_any(python_constraint):
dev_dependencies["pytest"] = "^4.6"
Expand Down
11 changes: 9 additions & 2 deletions poetry/layouts/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@
from poetry.utils.helpers import module_name


TESTS_DEFAULT = u"""from {package_name} import __version__
TESTS_DEFAULT = u"""from pathlib import Path
import toml
from {package_name} import __version__ as module_version
def test_version():
assert __version__ == '{version}'
pyproject_file = Path(__file__).parents[1] / "pyproject.toml"
pyproject = toml.load(pyproject_file)
pyproject_version = pyproject["tool"]["poetry"]["version"]
assert module_version == pyproject_version
"""


Expand Down

0 comments on commit cfe6865

Please sign in to comment.