Potresti usare un'import relativo: from .. import foo (se sei su python2 dovrai importare anche absolute_import da future )
https://www.python.org/dev/peps/pep-0328/#guido-s-decision Il giorno 5 agosto 2015 17:22, Manlio Perillo <manlio.peri...@gmail.com> ha scritto: > Oggi per la prima volta sto lavorando ad un progetto che contiene più di > un package: > > pkg/ > foo/ > bar/ > test/ > foo/ > bar/ > > La directory `test` contiene la test suite. > > Il problema è che quando eseguo i test con nosetests, l'istruzione > `import foo` importa il package da `pkg/test/foo` invece che `pkg/foo`. > > Ho provato anche con l'opzione `-P --no-path-adjustment` ma niente da > fare. Il package è stato correttamente installato con `setup.py develop` > all'interno di un virtual environment. > > Alla fine ho dovuto rinominare i packages in test: > > pkg/ > ... > test/ > _foo/ > _bar/ > > Qualcuno può confermare il problema e suggerire una soluzione? > > > Grazie Manlio > > _______________________________________________ > Python mailing list > Python@lists.python.it > http://lists.python.it/mailman/listinfo/python > >
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python