Thursday, May 26, 2016

A little more about Pytest-HTML

As I said before, my project for this summer is about creating enhancements to a plugin named Pytest-HTML, but I didn't say here what is that, in this post, I'll explain a bit.

If you don't know even what is Pytest, I'll try to explain in a few words (if you know, you may skip the following two paragraphs): Pytest is a tool to guarantee that the code you have done in Python is doing what it is supposed to do. Just giving a very simple example, if you have a function named "sum(x1, x2)", what would expect that this function does? Most probably, sum x1 and x2, right? Imagine the situation where x1 and x2 are 2, your expectation is that the function returns 4 to you, right? If it returns any other value (e.g, 9, 8, 2) most probably your function is not doing what it is supposed to do. So to code what I just mentioned above, you would do something like:

 def sum(x1, x2):  
   return x1 + x2 
 def test_sum():  
   assert sum(2, 2) == 4  

So, the function sum is returning x1 + x2, and the test_sum() is asserting that its return is 4. If you copy and paste this code into a file named "" and after installing python and pytest (To install it, run "sudo apt-get install python", and "sudo pip install pytest", in Linux and Mac), you can run on your terminal something like "py.test", it will return the name of your file followed by a single dot indicating that your test has passed, something like " ." . So, it is a very, very quick introduction to Pytest, there is much more you may read about in Python and Pytest websites linked above.

Okay, now you already know what is Pytest, but what is Pytest-HTML? As I said, to indicate that a tests has passed or not, Pytest returns to you a single spot on your terminal. But what if you want the results of your test on a browser? Well, that is what this plugin of Python does: it creates a HTML page (HTML is the language that your browser understands), so instead of seeing just a dot, you see something like the image bellow:

To have your tests in a HTML page like the one above, first you must install (after having python and pytest installed) pytest-html by typing on your terminal "sudo  pip install pytest-html" and after that, run "py.test --html=name_of_html_file.html", and then open the file generated on your browser (by default, the file is generated on the same directory of your test).

If you want to contribute with the development of python, pytest or pytest HTML, you may visit the following gitHub repositories:

Sunday, May 22, 2016

Fun starts tomorrow!

So, it has been a few weeks since I got the big news that I was selected to Outreachy, and tomorrow my internship is finally going to start.

Since my selection,  I started to feel a bit overwhelmed (not in a bad way, actually in a great way), many things happening. First there was all the happiness of being selected to such a nice program. After that, there was an invitation of Mozilla to go to London to participate in All Hands meeting, and then a suggestion of my mentor to go to Freiburg (Germany) to take part in Pytest Sprint. So I started to plan my travel, book tickets, fill forms, etc. Now I got the news that I am going to receive a MacBook offered by Mozilla too (it all - travel to Europe, meeting so many new amazing people, 5.5 K, MacBook, etc. - still seems too good to be true).  Combined with that, there are the last weeks of my semester at school, so many school assignments as well. So, wow, many things happening.

That is how Outreachy made me feel those initial days

Well, since my application, I unfortunately didn't have much time to work on my project. The last patch I submitted was the one I used on my application. But tomorrow, the fun is supposed to begin (if I don't have 3 tests this week), I already have my first task that I agreed with my mentor: this one. This first week, I'll try to create a design to be implemented the next week.

My project for this summer is about creating enhancements to a HTML plugin to PyTest (this plugin shows tests results in a HTML page), the first enhancement that I linked above is about allowing an user to filter the results of the tests by its outcome. So I expect in two weeks come back here talking a little about the design and the implementation for this issue.

Monday, May 2, 2016

What is Outreachy and how to apply for it

Outreachy is an internship program for underrepresented people in Free and Open Source Software (FOSS) community, if you have ever heard about Google Summer of Code (GSoC), Outreachy is much like this program. If you have never heard about GSoC neither Outreachy, I'll explain what is that about in a few words: the accepted students get paid (USD 5500) for contributing to a FOSS project for 3 months. The program runs twice a year, from May to August and from December to March. To apply to Outreachy, you have to write a patch to a participating FOSS organization and after that fill the application form.

So I am one of the students accepted for the round of May to August, and I'll write here some application tips based on my personal experience to future applicants (just saying, it is my own experience, not an official guide or something, maybe your experience will be different from mine).
  1. Don't feel afraid if you have heard about the program close to the deadline and don't have much experience: When I heard about the program (by a blog post while surfing the web, maybe as you now), there was less than two weeks to go before the deadline, and the applications were running for almost a month when I knew about it. I thought that it would be impossible for me (at least this time), I didn't have any previous contact with those organizations, I thought that only two weeks wouldn't be enough to get to know them and write an application... But I tried, and it worked :) So first of all, is: don't let the challenge of contributing to a FOSS organization that you don't know in a short period of time limit you!  :)
  2. Explore the projects a little, but focus on one: When I decided that I would apply to Outreachy, I started to explore the participant organizations. At some point, I decided that I would apply to Mozilla, but inside Mozilla, there were a lot of different projects that I could apply, and I felt a little lost. But I did a short list with three projects that I was most interested in and contacted the mentors of those projects to know how I could contribute with them (to participate in Outreachy, you have to submit a small patch). The mentors were very receptive and they send some patches that I could work on, but when I was studying about the projects and the issues, one project was the most interesting for me: one related to Pytest and HTML. So I actually started to write my contribution. Maybe if you have more than two weeks to write your application, you can write two applications, but in my case I only had time for one.
  3. Do a good contribution: While I was applying, I was also encouraging some friends to apply as well, I was talking to a friend about the needed patch and she said: "I'll solve the easiest issue there" (she didn't get selected :P). I didn't solve the easiest issue there, but the one that seemed to be more interesting to me. And because it was not that easy to solve (I had to write some lines of code) I got many corrections from my mentor and I think we started to have some kind of closer relation (like, I had to talk to him almost everyday this week to get some help with the issue). Because I am a very anxious person, I've taken a look on the contributions of the other applicants to the project I was applying, and I saw that nobody has done a contribution that they actually had to write some code, it was basically change some parameters or delete some lines of code (And I got selected, they no).
  4. Write a good application and communicate:  In the application form there are some questions about our backgrounds, I was not very sure if writing a good application would help me a lot (because I thought that the background + the patch would be more important) but after hearing from my mentor I think it was as important as the patch and the background; in an email after the selection he said "[...] and I particularly liked seeing your enthusiasm and how well you've communicated throughout your application.". So my fourth tip to get selected to Outreachy is communicate well why you are so excited to be part of this program (I was very excited to be part of it, and now I am very excited to the internship start, and I could communicate that on my application).
That is all! Good Luck with Outreachy! :D