Skip to content

[WIP] Update docs to sync with cookiecutter master branch#3556

Merged
mmerickel merged 37 commits intoPylons:masterfrom
stevepiercy:docs-synch-cookiecutter-pr-71
Jan 4, 2020
Merged

[WIP] Update docs to sync with cookiecutter master branch#3556
mmerickel merged 37 commits intoPylons:masterfrom
stevepiercy:docs-synch-cookiecutter-pr-71

Conversation

@stevepiercy
Copy link
Copy Markdown
Member

@stevepiercy stevepiercy commented Dec 27, 2019

  • docs/quick_tour.rst
  • docs/narr/project.rst
  • docs/quick_tutorial/*
  • docs/tutorials/wiki/*
  • docs/tutorials/wiki2/*
  • Any files that refer to docs/narr/myproject

See #3523

@stevepiercy stevepiercy added this to the 2.0 milestone Dec 27, 2019
@stevepiercy stevepiercy self-assigned this Dec 27, 2019
@stevepiercy
Copy link
Copy Markdown
Member Author

This monster is ready for review.

@mmerickel
Copy link
Copy Markdown
Member

Let's say hypothetically I moved the tests out of the package. On a scale from -1 to +1 how annoyed would you be to re-sync this again?

@stevepiercy
Copy link
Copy Markdown
Member Author

+1. Tests are the least troublesome to synch, as they are at the end of every tutorial. It'll have to wait till Monday night though.

@mmerickel
Copy link
Copy Markdown
Member

mmerickel commented Dec 29, 2019 via email

@stevepiercy
Copy link
Copy Markdown
Member Author

If you're feeling ambitious, test coverage for both the sqlalchemy and zodb backends are low, and maybe move source into /src/package?

@mmerickel
Copy link
Copy Markdown
Member

I do not want to move the source into /src/package - I don't do it in my own apps and I think it's mostly valuable for libraries versus apps. I have made the change to move the tests but won't do anything to increase coverage atm.

@stevepiercy
Copy link
Copy Markdown
Member Author

@mmerickel I could use some help with one failing test.

def test_run(self):
from tutorial.scripts.initialize_db import main
main(argv=['foo', 'development.ini'])
self.assertTrue(os.path.exists('tutorial.sqlite'))
os.remove('tutorial.sqlite')

E       sqlite3.IntegrityError: UNIQUE constraint failed: users.name

The database already exists and has been populated with data from an earlier step in the tutorial when changing the models. If I change the database name in development.ini to tutorialtest.sqlite and adjust the test accordingly, it passes. Obviously that is not the right way, but I couldn't figure out the right way.

Also there are a couple of warnings, one for imp, which will go away in a future release, but there are a couple of other warnings:

tests/test_functional.py::FunctionalTests::test_anonymous_user_cannot_add
tests/test_functional.py::FunctionalTests::test_anonymous_user_cannot_add
  /Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.7/site-packages/pkg_resources/__init__.py:1145: DeprecationWarning: Use of .. or absolute path in a resource path is not allowed and will raise exceptions in a future release.
    self, resource_name

I fiddled around with that for a while, but nothing obvious jumped out at me.

@stevepiercy
Copy link
Copy Markdown
Member Author

This PR is now ready for review, and except for the above mentioned failing test and test warnings, can be merged.

@mmerickel
Copy link
Copy Markdown
Member

mmerickel commented Jan 3, 2020

The test should be either

  1. removed

  2. modified to just skip itself if the database already exists

  3. modify initialize_db to support being run multiple times

in its current form, initialize_db is meant to be run only one time ever. So if the database already exists it will fail to run again. The bug here (imo) is having this test in the first place and I'd just remove it.

@stevepiercy
Copy link
Copy Markdown
Member Author

Thanks. Removal was my first thought. Tests should be repeatable, and modifying the script would feel like accommodating something that doesn't need to be accommodated.

stevepiercy added a commit to stevepiercy/pyramid that referenced this pull request Jan 3, 2020
@stevepiercy stevepiercy force-pushed the docs-synch-cookiecutter-pr-71 branch from fc1e1d4 to b5fec39 Compare January 3, 2020 07:33
@stevepiercy
Copy link
Copy Markdown
Member Author

I rebased this branch on master, resolved conflicts and merged, then force pushed. I guess that wasn't the proper procedure, looking at the commit history.

@mmerickel
Copy link
Copy Markdown
Member

is this ready for review then or still wip?

@stevepiercy
Copy link
Copy Markdown
Member Author

The only thing missing is how to resolve the warnings in #3556 (comment)

I couldn't figure it out. Otherwise it is ready for review.

@merwok
Copy link
Copy Markdown
Contributor

merwok commented Jan 3, 2020

I would edit the pkg_resources code in site-packages to add/change stacklevel parameter to warnings.warn in order to find the faulty code.

@stevepiercy
Copy link
Copy Markdown
Member Author

Thanks for the tip! I'll try that out tonight, after daylight runs out.

@stevepiercy
Copy link
Copy Markdown
Member Author

PyCharm caching of diff will be the death of me. Refreshing cache revealed the file diff.

Thanks to the tip to modifying pkg_resources, I found a few files that did not show up in PyCharm's diff that used ../ instead of tutorial: for the renderer. I had to change msg = "Use of .. or absolute path in a resource path is not allowed." to include str(path.split(posixpath.sep)), which revealed the offending files.

Changes pushed, and this PR is now complete and ready for review. Ping @mmerickel.

@mmerickel
Copy link
Copy Markdown
Member

I pushed one small tweak to find_packages. This is great work. I'm going to merge it and will try to update the tutorials this weekend.

@mmerickel mmerickel merged commit 148cf51 into Pylons:master Jan 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants