satanas / libturpial

libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims to support all the features for each protocol. This library is the backend used for Turpial

Home Page:http://turpial.org.ve

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tests try to access the home directory of the user running the file

satanas opened this issue · comments

Nomadium comments:

Hi folks,

I'm looking for help with this bug. For full context, please take a
look at:

What is happening here is: a Debian autobuilder is unable to build
libturpial from source. This is a serious bug and has caused to get
turpial dropped from testing.

The autobuilder is failing because libturpial unit tests are trying to
write in the homedir of the user who is running the build and this
violates Debian guidelines (a package should not try to write outside
its builddir).

I was hacking the unit tests but I'm unable to get a reasonable fix
for this issue. The files with problematic unit tests are:

  • tests/test_column_manager.py
  • tests/test_account_manager.py
  • tests/test_core.py

I stumbled upon these two situations:

  • I tried to pass an explicit basedir to libturpial.config.AppConfig
    constructor to override the default basedir pointing to the homedir of
    the user running libturpial. I did this on tests/test_column_manager.py
    and tests/test_account_manager.py.
  • On tests/test_core.py I noticed that I can't specify an explicit
    basedir when you create an instance of libturpial.api.core.Core, so this
    is going to try to create ~user/.config/turpial.

I'm looking for help to get a fix or workaround for this issue.

Why don't we just mock the file? Will that be possible?

We shouldn't be creating files or making requests on unit tests anyways.

Will that be a reasonable fix?

Yes, mocking should be fine, we just need to test that the module does what it has to do 👍