Posts

Showing posts from November, 2017

Making automated testing for a Python lib using TravisCI

My Github link: jayyyin setting up Travis with python can be a pain but as long as you follow some steps it should be quite painless first determine if you're going to be using pytest, in my case I am since it seems like a good way to test things, in the repo directory you'll need a .travis.yml containing the following: second determine what your rootdir for pytest will be, in my case it's just called python thirdly by default only filenames starting with test_ will be read into pytest or you'll get a no results when collecting files to set things up I have a pytest.ini file in the root of the repo (the same directory as readme.md) within it is as follows: [pytest] testpaths = python that tells pytest to look in the python directory (if you want to add more just separate them by spaces like so): [pytest] testpaths = directory1 directory2

Building a Python Library for returning basic file info (ongoing)

Things are going smoothly so far since working with strings and filenames are pretty straight forward in python 3.6 my github project so far: https://github.com/jayyyin/python-filelib-thingy going with the simplest task of extracting filename from a path in python comes with a built in module called os.path,really useful  getting the filesize of the file was a bit more tricky as it could be either an absolute path or relative path as it is more complicated I'll use a code snippet from my github