Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meaningful tests to new-layout #2366

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
13 changes: 11 additions & 2 deletions poetry/layouts/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@
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