google-research / arxiv-latex-cleaner

arXiv LaTeX Cleaner: Easily clean the LaTeX code of your paper to submit to arXiv
Apache License 2.0
5.04k stars 318 forks source link

Fix relative filenames referenced with './' in tex #56

Closed Vaufreyd closed 2 years ago

Vaufreyd commented 2 years ago

some files 'path/to/file' are referenced in tex as './path/to/file' thus add prefix for relative paths starting with './' or '.\' to regex search

jponttuset commented 2 years ago

Thanks @Vaufreyd! Since this change is at the core of the tool, could you please add some test to it? (e.g. change the integration test to cover these cases)

Vaufreyd commented 2 years ago

@jponttuset As far as I saw, I need to modify the 'tex' folder and to prepare accordingly the 'tex_arxiv_True' folder to reflect what what is expected. Am I right? Anything else?

jponttuset commented 2 years ago

For the integration test, that's correct. Ideally, you'd modify the unit tests for the _search_reference function you modified too, i.e. test_search_reference_weak and test_search_reference_strong.

To check that all tests pass, you can run:

python -m unittest arxiv_latex_cleaner.tests.arxiv_latex_cleaner_test

Thanks!

Vaufreyd commented 2 years ago

Thanks. I will add that next week.

Vaufreyd commented 2 years ago

Hi,

Sorry for my late answer. I have a question. Under (my French) Windows, the original unitest failed (it works on Ubuntu Linux). The failing trace:

F..................................................................
======================================================================
FAIL: test_complete (arxiv_latex_cleaner.tests.arxiv_latex_cleaner_test.IntegrationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "XXX\test\arxiv-latex-cleaner\arxiv_latex_cleaner\tests\arxiv_latex_cleaner_test.py", line 672, in test_complete
    self._compare_files(
  File "XXX\test\arxiv-latex-cleaner\arxiv_latex_cleaner\tests\arxiv_latex_cleaner_test.py", line 638, in _compare_files
    self.assertTrue(
AssertionError: False is not true : tex_arXiv/main.tex and tex_arXiv_true/main.tex are not equal.

----------------------------------------------------------------------
Ran 67 tests in 0.273s

FAILED (failures=1)

From my first checks, it looks like the encoding of both file differs. Thus, is it ok if I propose a unitest working only on Linux for the moment? I may have time later to check more deeply why it is failing on my Windows and maybe propose a patch)?

Thank you. Doms.

PS: My env for information:

absl-py                   1.0.0                    pypi_0    pypi
arxiv-latex-cleaner       0.1.25                    dev_0    <develop>
ca-certificates           2021.10.26           haa95532_4
certifi                   2021.10.8        py39haa95532_2
openssl                   1.1.1m               h2bbff1b_0
pillow                    9.0.1                    pypi_0    pypi
pip                       21.2.4           py39haa95532_0
python                    3.9.7                h6244533_1
pyyaml                    6.0                      pypi_0    pypi
setuptools                58.0.4           py39haa95532_0
six                       1.16.0                   pypi_0    pypi
sqlite                    3.37.2               h2bbff1b_0
tzdata                    2021e                hda174b7_0
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wheel                     0.37.1             pyhd3eb1b0_0
wincertstore              0.2              py39haa95532_2
jponttuset commented 2 years ago

Hi @Vaufreyd

I have never tested the code under Windows, so for me it's fine if you only test it on Linux. If you later propose a patch for Windows, that'd be even better!

Best,

Vaufreyd commented 2 years ago

Hi @jponttuset,

I added 3 commits to my pull request. As far as I tested, the unit tests are passing. Let me know.

Best.

jponttuset commented 2 years ago

Thanks @Vaufreyd!