Closed Bug 1460035 Opened 4 years ago Closed 4 years ago

implement python 3 test scaffolding


(Socorro :: General, task, P2)


(Not tracked)



(Reporter: willkg, Assigned: willkg)




(1 file)

There are a few ways we can rewrite code so that it works with Python 3. The way I want to do it since it allows us to work through it step-by-step (which is helpful when we have a massive codebase with many parts) is to rewrite things logical part by logical part to work in both Python 2 and 3 where possible.

I think the easiest way to do that is to introduce a second round of tests in addition to the unit tests we run with Python 2 in CI. The second round would run specific tests we know work in Python 3.

Over time, the Python 3 tests grow and grow until it encompasses the entire codebase. Then we switch.

This bug covers writing the scaffolding to run a specific set of tests in Python 3.
I have some ideas on this, so I'll grab it to work on soon.

This, or something equivalent, is a necessary step to doing the 2-to-3 work, so doing it soon is good.
Assignee: nobody → willkg
Priority: -- → P2
I've got something working.

To set it up, you do:

    make dockerbuild3

Then you open the shell in the python3 test container:

    make dockertestshell3

From there, you can run pytest on specific files, directories, etc. We'll keep track of all the known working files/directories in an array in docker/ You can use that script to run all the known working files/directories.

An iteration of fixing things would be like this:

1. make dockerbuild3
2. make dockertestshell3
3. iterations of:

   3.1. pytest some/
   3.2. fix issues

4. add some/ to WORKING_TESTS in docker/
5. make dockertest3 to run everything we know works

At some point, we should hook this up to CI, but right now flake8 flips out with lots of errors for things that are not Python 3 friendly. I'll write up a bug for fixing the linting errors and one for hooking it up to CI. I'll also document this all in a "everything you wanted to know about making Socorro python3-friendly" guide which will be available in comic book format on Gumroad for $5.

How does this sound so far? Does it look ok?
Flags: needinfo?(mkelly)
Flags: needinfo?(chris.lonnen)
Sounds fine to me. I wouldn't go much farther for fear of not leaving enough work for the interns.
Flags: needinfo?(mkelly)
Commits pushed to master at
fix bug 1460035: implement python 3 test scaffolding

This adds a couple of make rules and shell scripts to give us scaffolding
with which we can iterate over fixing code to make it work in both
Python 2 and Python 3.

In order to get the tests to run at all, I had to fix a bunch of Python
3 issues. I also hoisted six to first-class dependency status.

This doesn't connect that with CI because linting fails epically. We'll do
that later.
Merge pull request #4444 from willkg/1460035-python3

fix bug 1460035: implement python 3 test scaffolding
Closed: 4 years ago
Resolution: --- → FIXED
Flags: needinfo?(chris.lonnen)
You need to log in before you can comment on or make changes to this bug.