Fix #257 - Ensure paths exist before using them

- Also, fix assertions
Merge pull request #260 from my-personal-forks/fix-257-paths

Fix #257 - Ensure paths exist before using them
Add tests for pub_package.py
Merge pull request #261 from my-personal-forks/tests-pub_package

Add tests for pub_package.py