DEV Community

loading...

Post #1 : Everyone can be struggling with it

Ybrahin Martinez
・Updated on ・3 min read

Hi again! This is the first blog post that I am writing, the previous was a check-in post. In these posts, I going to summarize all the tasks that I will be doing in the GSoC, but without a formal structure so, shall we begin.

The first week was finished and in general, it was great! I had to work to fix some of the problems that the quizzes had with my other teammate. We split all the quizzes to work on the same number of quizzes. In each quiz, I had to fix and refactor the exercises following the guidelines of Runestone, ReStructuredText, and PEP8 to Python. In addition, I built tests using the playwright tool, as I said in my previous post, it is a tool to create automated end-to-end tests, below there is an example and his result.

The code

def test_quiz5_10(page):
    # Go to http://localhost:8000/quiz/Quiz5.html
    page.goto("quiz/Quiz5.html")
    page.wait_for_load_state()

    page.click("text=def es_numero_ponteironuloville(numero):")

    page.press(
        "text=es_numero_ponteironuloville(numero):",
        "ArrowDown"
    )
    page.press("text=es_numero_ponteironuloville(numero):", "Tab")

    page.type(
        "text=es_numero_ponteironuloville(numero):",
        "return True"
    )

    page.click("#q5_10 >> *css=button >> text=Run")

    page.hover("#q5_10 >> text=You passed:")
    assert (
        page.inner_text("#q5_10 >> text=You passed:")
        == "You passed: 50.0% of the tests"
    )
Enter fullscreen mode Exit fullscreen mode

The result of test
Result of test created with playwright

I have to say that despite being the first time I use it, it was kind of simple, however, the tests that I built weren't very complicated, but I don't know if this can change in the future πŸ˜… .

At the end of this week, I've done 6 PR's, 5 of which have been merged into the principal branch, and 1 is awaiting review. With these, I've closed 2 issues that were been created previously to achieve my first milestone successfully, so I think that I am going at good steps.

Not all was easy because to ensure the PEP8 guidelines in the Python codes, I had to use black and flake8 but only in the python codes, so I had to extract these portions from the Rst files in another one and save it such as a Python file and after that paste to the Rst files again, it wasn't a hard task however it was very repetitive, but I know that sometimes programming can be like this, the important thing is to keep going.

Another thing that I was struggling with, was a problem that I found and for luck, I resolved it with the command git rebase. I heard about it but I didn't have to use it before. I can assure you, it has too much power even to rewrite the history of git (I will explain later on), although as uncle Ben said.

so, we have to be careful to use it πŸ‘Œ

In this case, I used it because in a PR that created I renamed a file, and I fixed the exercises in there, however, for git, what I did was delete that file and create another with the code, and according to one of my mentors, isn't a good coding practice because it is difficult of review it, since you lost all the previous code and the diff shows only new things, for that reason I had to made a new PR only to rename that file, and after this one has been merged, I was able to finish the other one.

Once that was merged I had a huge conflict problem with that file in that PR, so it was time to use the rebase power wisely.

First, I had checkout to the main branch on my local computer, pull all the changes of my remote repository, after that I checkout again to the branch of my changes, and finally rebase this branch with my main branch. This sounds easy, but it was kind of stressful because I had to review each change of all the commits behind HEAD, that is, all the changes that I previously made in that branch, and only after resolving all the conflicts the results were that my changes were successfully added in front of HEAD, as if the previous commits had not existed, so somehow I changed the history of the project in git 🀯.

Quality work

Discussion (0)